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 |
各位大牛看看。我这里哪里出错了#include<iostream> using namespace std; int main(void) { int n,i; char num[8]; int sum; int j,p,l; const int map[]={9,3,7}; const int Map[3][9]={ {9,8,7,6,5,4,3,2,1}, {7,4,1,8,5,2,9,6,3}, {3,6,9,2,5,8,1,4,7} }; cin>>n; for(i=1;i<=n;i++) { cin>>num; l=strlen(num); sum=0; for(j=0;j<l;j++) if(num[j]=='?') p=j; else sum=(sum+(num[j]-'0')*map[(l-j-1)%3])%10; num[p]=Map[(l-p-1)%3][9-sum]+'0'; cout<<"Scenario #"<<i<<":"<<endl; cout<<num<<endl; 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