a020.
身分證檢驗
| From: [36.225.247.1] |
發表日期
:
2014-01-14 13:59
#include <stdio.h>
int main(){
char array[10];
int value;
while(~scanf("%s", &array)){
switch(array[0]){
case 65 ... 72:value=array[0]-55; break;
case 73:value=array[0]-39; break;
case 74 ... 78:value=array[0]-56; break;
case 79:value=array[0]-44; break;
case 80 ... 86:value=array[0]-57; break;
case 87:value=array[0]-55; break;
case 88 ... 89:value=array[0]-58; break;
case 90:value=array[0]-57; break;
}
value=(value/10)+((value%10)*9)+(array[1]-48)*8+(array[2]-48)*7+(array[3]-48)*6+(array[4]-48)*5+(array[5]-48)*4+(array[6]-48)*3+(array[7]-48)*2+(array[8]-48)*1+(array[9]-48);
if(value%10==0) printf("real\n");
else printf("fake\n");
}
return 0;
}