#8297: 这样就可以。


WG1994 (WG1994)

學校 : 不指定學校
編號 : 35383
來源 : [120.201.103.213]
最後登入時間 :
2014-04-18 22:20:33
a020. 身分證檢驗 | From: [113.233.4.180] | 發表日期 : 2013-10-06 20:36

#include"stdio.h"
int main()
{
char ID[10];
int a;
while(gets(ID))
{
int temp;
temp = (ID[1] - '0') * 8 + (ID[2] - '0') * 7 + (ID[3] - '0') * 6 + (ID[4] - '0') * 5 + (ID[5] - '0') * 4 + (ID[6] - '0') * 3 + (ID[7] - '0') * 2 + (ID[8] - '0') * 1 + (ID[9] - '0');
if(ID[0] == 'A')
{
a = 1 + temp;
}
else if(ID[0] == 'B')
{
a = 10 + temp;
}
else if(ID[0] == 'C')
{
a = 19 + temp;
}
else if(ID[0] == 'D')
{
a = 28 + temp;
}
else if(ID[0] == 'E')
{
a = 37 + temp;
}
else if(ID[0] == 'F')
{
a = 46 + temp;
}
else if(ID[0] == 'G')
{
a = 55 + temp;
}
else if(ID[0] == 'H')
{
a = 64 + temp;
}
else if(ID[0] == 'I')
{
a = 39 + temp;
}
else if(ID[0] == 'J')
{
a =  73 + temp;
}
else if(ID[0] == 'K')
{
a = 82 + temp;
}
else if(ID[0] == 'L')
{
a = 2 + temp;
}
else if(ID[0] == 'M')
{
a = 11 + temp;
}
else if(ID[0] == 'N')
{
a = 20 + temp;
}
else if(ID[0] == 'O')
{
a = 48 + temp;
}
else if(ID[0] == 'P')
{
a = 29 + temp;
}
else if(ID[0] == 'Q')
{
a = 38 + temp;
}
else if(ID[0] == 'R')
{
a = 47 + temp;
}
else if(ID[0] == 'S')
{
a = 56 + temp;
}
else if(ID[0] == 'T')
{
a = 65 + temp;
}
else if(ID[0] == 'U')
{
a = 74 + temp;
}
else if(ID[0] == 'V')
{
a = 83 + temp;
}
else if(ID[0] == 'W')
{
a = 21 + temp;
}
else if(ID[0] == 'X')
{
a = 3 + temp;
}
else if(ID[0] == 'Y')
{
a = 12 + temp;
}
else
{
a = 30 + temp;
}
if(a % 10 == 0)
{
printf("real\n");
}
else
{
printf("fake\n");
}
}
return 0;
}
 
ZeroJudge Forum