a020.
身分證檢驗
| From: [122.122.14.188] |
發表日期
:
2011-07-12 18:31
#include<iostream>
using namespace std;
int main()
{
int i,sum=0;
char x[11];
char a[26]={'A','B','C','D','E','F','G','H','J','K',
'L','M','N','P','Q','R','S','T','U','V','X','Y','W'
,'Z','I','O'};
while(cin>>x)
{
for(i=0;i<26;i++)
{
if(x[0]==a[i])
{
i=i+10;
sum=sum+(i/10)+((i%10)*9);
break;
}
}
for(i=1;i<=8;i++)
{
sum=sum+((x[i]-48)*(9-i));
}
sum=sum+(x[9]-48);
if(sum%10==0)
cout<<"real"<<endl;
else
cout<<"fake"<<endl;
}
return 0;
}