#18699: WA(line:23)??


shaun0124 (debugger)

學校 : 國立臺灣師範大學附屬高級中學
編號 : 98989
來源 : [118.160.92.221]
最後登入時間 :
2019-10-19 14:31:32
a020. 身分證檢驗 | From: [49.159.173.254] | 發表日期 : 2019-07-29 19:18

#include <iostream>

using namespace std;

int main()
{
char C[36]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9'};
int I[36]={1,0,9,8,7,6,5,4,9,3,2,2,1,0,8,9,8,7,6,5,4,3,1,3,2,0,0,1,2,3,4,5,6,7,8,9};
char n[10];
int sum;
while(cin>>n){
sum=0;
for(int i=0;i<=25;i++){
if(n[0]==C[i]){
sum+=I[i];
break;
}
}

for(int i=1;i<=8;i++){
for(int j=26;j<=35;j++){
if(n[i]==C[j]){
sum+=(9-i)*I[j];
break;
}
}
}
for(int i=26;i<=35;i++){
if(n[9]==C[i]){
sum+=I[i];
break;
}
}
if(sum%10==0){
cout<<"real"<<endl;
}
else{
cout<<"fake"<<endl;
}
}
return 0;
}

 
ZeroJudge Forum