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 |
为什么是WRONG ANSWER,,,,,,谁来告诉我撒??疯掉了#include <iostream> using namespace std; int R; int n; int h; int dot_index; char s[6]; int r_int[125]; void power(int r[],int R) { for(int i=0;i<=h;i++) { r[i]*=R; } int i=0; while(i<h) { r[i+1]+=r[i]/10; r[i]=r[i]%10; i++; } while(r[i]/10!=0)//critical { r[i+1]+=r[i]/10; r[i]=r[i]%10; i++; } h=i; } int main() { n=0; while(cin>>s>>n) { R=0;h=0;dot_index=0; for(int i=0;i<5;i++) { if(s[i]=='.') dot_index=(5-i)*n-1; } for(int i=0;i<=5;i++) { if(s[i]!='.') R=R*10+(s[i]-'0'); } if(R==0) { cout<<0<<endl; continue; } memset(r_int,0,sizeof(r_int)); r_int[0]=1; for(int i=0;i<n;i++) power(r_int,R); int trail=0; if(dot_index!=0) { for(;trail<=dot_index;trail++) { if(r_int[trail]!=0) break; } } for(;h>=trail;h--) { if(dot_index==h) cout<<"."; cout<<r_int[h]; } cout<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator