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 |
贴代码了In Reply To:怎么我用G++还是不过???郁闷... Posted by:qiqilrq at 2007-05-09 19:59:58 Source Problem Id:2498 User Id:qiqilrq Memory:64K Time:78MS Language:G++ Result:Wrong Answer Source #include <stdio.h> #include <string.h> int F[3]={9, 3 ,7}; char id[9]; int sum; int main() { int i, j, T, que, len;scanf("%d", &T); for(i=1; i<=T; i++){ scanf("%s", id); len=strlen(id); sum=0; for(j=0; j<len; j++) { if(id[j]=='?') que=j; else sum+=(int)(id[j]-'0') * F[((len-j-1)%3)]; } sum%=10; sum=10-sum; for(j=0; j<10; j++) if( (j*F[((len-que-1)%3)])%10 == sum ) break; id[que]=(char)('0'+j); printf("Scenario #%d:\n%s\n\n", i, id); }//end for return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator