标签:void process 高精度幂 ase i++ bre alt namespace func
#include<bits/stdc++.h>
using
namespace
std;
string s;
int
n,z,len,y,a[10000],b,k;
void
multi(
int
b){
for
(
int
i=1;i<=len;i++)a[i]*=b;
for
(
int
i=1;i<=len-1;i++)a[i+1]+=a[i]/10,a[i]%=10;
while
(a[len]>=10)a[len+1]=a[len]/10,a[len]%=10,len++;
}
int
main(){
while
(cin>>s>>n){
memset
(a,0,
sizeof
(a));b=k=len=y=0;
if
(n==0){cout<<1<<endl;
continue
;}
for
(
int
i=0;i<6;i++)
if
(s[i]==
‘.‘
){z=i;
break
;}
while
(s[s.size()-1]==
‘0‘
)s.erase(s.size()-1,1);
len=s.size();s.erase(z,1);y=len-z-1;k=y*n;len--;
for
(
int
i=0;i<len;i++)a[len-i]=s[i]-
‘0‘
,b=b*10+s[i]-
‘0‘
;
for
(
int
i=2;i<=n;i++)multi(b);
for
(
int
i=len;i>k;i--)cout<<a[i];
if
(k!=0)cout<<
‘.‘
;
for
(
int
i=k;i>=1;i--)cout<<a[i];
puts
(
""
);
}
return
0;
}
标签:void process 高精度幂 ase i++ bre alt namespace func
原文地址:https://www.cnblogs.com/jiazizheng/p/9359405.html