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() { long N; char str[100]={'\n'}; int number[3]={9,3,7}; int k=0; long sum =0; int temp =0; int j =0; int temp2 =0; int number2 =0 ; int length = 0; cin>>N; while (N--) { sum =0; temp =0; number2 = 0; j=0; k++; cin>>str; length = strlen(str)-1; for (int i=length,j=0;i>=0;i--,j++) { if (str[i]=='?') { temp=i; number2 = j; } else sum+=(str[i]-48)*number[j%3]; } for (int i=1;i<10;i++) { temp2 = number[number2%3] * i; if (!((temp2+sum)%10)) { str[temp] = i+'0'; } } cout<<"Scenario #"<<k<<":\n"; cout<<str<<endl<<endl; memset(str,'\n',100); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator