| ||||||||||
| 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<stdio.h>
#include<iostream.h>
#include<string.h>
main(){
int n,i,factors[7]={9,3,7,9,3,7,9},sum,set,ii;
char a[8];
cin>>n;
for(int j=1;j<=n;j++){
sum=0;
gets(a);
for(i=strlen(a)-1;i>=0;i--){
if(a[i]=='?'){
ii=i;
set=factors[strlen(a)-i-1];
continue;
}
else sum+=factors[strlen(a)-i-1]*(a[i]-'0');
}
for(i=0;i<=9;i++){
if((10-sum%10)==(i*set)%10){
a[ii]=i+'0';
break;
}
else continue;
}
cout<<"Scenario #"<<j<<":"<<endl;
puts(a);
cout<<endl;
}
return 1;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator