| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:帮我看看哪错了,我能想到的数据都过了啊!!In Reply To:帮我看看哪错了,我能想到的数据都过了啊!! Posted by:snowsword at 2006-11-26 15:34:42 > #include <iostream>
>
> using namespace std;
>
> void p(double ss,int n)
> {
> int point,i,s,l;
> if (ss<10)
> {
> point=4;
> s=ss*10000;
> }
> else
> {
> point=3;
> s=ss*1000;
> }
>
> int a[200]={0},c,d;
> a[0]=s%10;
> a[1]=(s/10)%10;
> a[2]=(s/100)%10;
> a[3]=(s/1000)%10;
> a[4]=(s/10000)%10;
> if (n!=1)
> {
> for (int j=2;j<=n;j++)
> {
> d=0;
> for (i=0;i<=199;i++)
> {
> c=a[i]*s+d;
> a[i]=c%10;
> d=c/10;
> }
> }
> }
> point=point*n;
> for (i=199;i>=0;i--)
> {
> if (a[i]!=0) break;
> }
> for (int j=0;j<=199;j++)
> {
> if (a[j]!=0) break;
> }
> if (point<=j)
> {
> for (int l=i;l>=point;l--)
> cout<<a[l];
> cout<<endl;return;
> }
> if (point>i)
> {
> cout<<'.';
> for (l=point-1;l>=j;l--)
> cout<<a[l];
> cout<<endl;
> return;
> }
> for (l=i;l>=point;l--)
> cout<<a[l];
> cout<<'.';
> for (l=point-1;l>=j;l--)
> cout<<a[l];
> cout<<endl;
> return;
> }
>
> int main()
> {
> int n;
> double ss;
> while(cin>>ss>>n)
> {
> if (ss==0.0)
> {
> cout<<0<<endl;
> continue;
> }
> p(ss,n);
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator