#22999:


hentailegend910415@gmail.com (心雨夜櫻)

學校 : 淡江大學
編號 : 131050
來源 : [27.51.121.135]
最後登入時間 :
2023-10-02 17:19:54
a020. 身分證檢驗 | From: [163.13.53.98] | 發表日期 : 2020-10-16 14:08

#include <iostream>

#include <string>

using namespace std;

int main(void){

string ID;

int sum=0;

cin>>ID;

char a[10];

ID.copy(a,10,0);

switch(a[0]){

case 'A':

sum=sum+1;

break;

case 'B':

sum=sum+10;

break;

case 'C':

sum=sum+19;

break;

case 'D':

sum=sum+28;

break;

case 'E':

sum=sum+37;

break;

case 'F':

sum=sum+46;

break;

case 'G':

sum=sum+55;

break;

case 'H':

sum=sum+64;

break;

case 'I':

sum=sum+39;

break;

case 'J':

sum=sum+73;

break;

case 'K':

sum=sum+82;

break;

case 'L':

sum=sum+2;

break;

case 'M':

sum=sum+11;

break;

case 'N':

sum=sum+20;

break;

case 'O':

sum=sum+48;

break;

case 'P':

sum=sum+29;

break;

case 'Q':

sum=sum+38;

break;

case 'R':

sum=sum+47;

break;

case 'S':

sum=sum+56;

break;

case 'T':

sum=sum+65;

break;

case 'U':

sum=sum+74;

break;

case 'V':

sum=sum+83;

break;

case 'W':

sum=sum+21;

break;

case 'X':

sum=sum+3;

break;

case 'Y':

sum=sum+12;

break;

case 'Z':

sum=sum+30;

break;

}

sum=sum+(a[1]*8)+(a[2]*7)+(a[3]*6)+(a[4]*5)+(a[5]*4)+(a[6]*3)+(a[7]*2)+(a[8]*1)+(a[9]);

if (sum%10==0){

cout<<"real";

}

else{

cout<<"fake";

}

return 0;

}

 

我檢查好多次了  還是找不到問題 

送出答案一直NA 

求解  謝謝

 
ZeroJudge Forum