a020.
身分證檢驗
| From: [36.225.51.218, 10.100.63.132] |
發表日期
:
2015-02-12 18:15
#include <stdio.h>
#include <stdlib.h>
int main()
{
char input[11];
int sum = 0, i, j, eng_loc=0;
int eng_new=0;
int chg[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 (scanf("%s", input) != EOF){
sum = 0;
eng_loc = input[0] - 'A';
eng_new += chg[eng_loc]/10 + (chg[eng_loc]%10)*9;
int kk=0;
for (kk=1;kk<=9;kk++){
input[kk] = input[kk] - '0';
}
for (i=1, j=8; i<9; i++, j--){
eng_new += input[i] * j;
}
eng_new += input[9];
if ((eng_new%10) == 0)
{
printf("real\n");
}
else
{
printf("fake\n");
}
}
return 0;
}