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> #include <string> using namespace std; int main() { int max,T,n,i,j,flag,ans,k=1; string s; cin>>T; while(T--){ cin>>s; for(i=0;i<s.length();++i){ if(s[i]=='?'){ ans=i; break; } } if(s.length()%3==1) flag=9; else if(s.length()%3==2) flag=3; else flag=7; for(j=0;j<10;++j){ max=0; s[ans]=j+48; for(i=0;i<s.length();++i){ max+=(int(s[i]-48))*flag; if(flag==9) flag=7; else if(flag==7) flag=3; else flag=9; } if(max%10==0) break; } cout<<"Scenario #"<<k++<<':'<<endl; if(max%10==0) cout<<s<<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