#18297: 簡解


Timmy_ (徐洛享)

學校 : 國立內壢高級中學
編號 : 79648
來源 : [223.139.90.197]
最後登入時間 :
2021-09-25 22:53:11
a020. 身分證檢驗 | From: [111.243.203.183] | 發表日期 : 2019-07-03 17:53

#include <iostream>
#include <cstring>
#include <stack>

using namespace std ;
int main ()
{
string line ;
const int idnum[26]={10,11,12,13,14,15,16,17,34,18,19,20,21,22,35,23,24,25,26,27,28,29,32,30,31,33};
while(cin >> line ){
char *lin = new char [line.length()+1];
strcpy(lin,line.c_str());
int com =0;
com = idnum[lin[0]-'A'];
com = com%10*9+com/10;
int y=8;
for(int x=1; x<=8 ; x++ ){
com = com + (int(lin[x])-'0')*y;
y--;
}
com += int(lin[9])-'0';
if(com%10==0)cout << "real"<< endl ;
else cout << "fake"<< endl;
}


return 0;
}

 
ZeroJudge Forum