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 |
怎么老是WA呢?拜托高手看看#include <iostream> #include <math.h> using namespace std; int main() { int n,nn,N[9],sum,i,*p; for (i=0;i<9;i++) { N[i]=0; } sum=0; cin>>n; while (n!=0) { nn=n; p=&N[8]; for (i=0;i<9;i++) { *p=n%10; n/=10; p--; } p=N; for (i=0;i<9;i++) { if (*p>=5) { (*p)--; sum+=*p*pow(float (9),int (8-i)); } else { sum+=*p*pow(float (9),int (8-i)); } p++; } cout<<nn<<": "<<sum<<endl; sum=0; cin>>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