a020.
身分證檢驗
| From: [114.43.116.174] |
發表日期
:
2014-03-28 19:46
#include<iostream>
using namespace std;
int main()
{
char id[10];
int p[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},a,b,c,d,i;
while(1)
{
cin>>id;
a=p[id[0]-65];
b=(a%10)*9+(a/10);
for(i=1;i<=8;i=i+1)
c=(id[i]-48)*(9-i);
d=b+c+id[9]-48;
if(d%10!=0)
cout<<"fake\n";
else
cout<<"real\n";
}
return 0;
}