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 |
help!!为什么都是WA!#include <stdio.h> #define M 125 void main() { int R[M]; float r1; int r,n,i,l=0; int f;//要打印的小数长度; int a;//要打印的整数长度; // while(scanf("%f %d",&r1,&n)!=EOF) { i=125; // while(--i) R[i]=0; if(10.00<=r1&&r1<99.999) f=3*n,a=2*n,r=r1*1000+0.5; else if(2.0<=r1&&r1<10.0) f=4*n,a=n,r=r1*10000+0.5; else if(1.0<=r1&&r1<2.0) f=4*n,a=1,r=r1*10000+0.5; else a=0,f=4*n,r=r1*10000+0.5; ////////////////////// ///////////////////////// R[0]=r%10; R[1]=(r%100)/10; R[2]=(r%1000)/100; R[3]=(r%10000)/1000; R[4]=(r%100000)/10000; ////////////////////////// while(--n) { for(i=0;i<M;i++) R[i]*=r; // for(l=0;l<M-2;l++){ R[l+1]+=R[l]/10; R[l]%=10; } } //if(a==0){ for(i=f+a;i>=f;i--) if(R[i]!=0) break; for(;i>=f;i--) printf("%d",R[i]); for(r=0;r<f;r++) if(R[r]!=0) break; if(r!=f) printf("%c",'.'); for(;i>=r;i--) printf("%d",R[i]); // } // else if() printf("%c",'\n'); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator