#19790: 都是fake?


ap665539@gmail.com (pineapple037)

學校 : 國立中正大學
編號 : 106840
來源 : [101.136.36.17]
最後登入時間 :
2020-11-30 02:41:50
a020. 身分證檢驗 | From: [101.137.22.26] | 發表日期 : 2019-10-31 00:46

可以幫我看哪裡有錯嗎
 
 
 
 
#include<stdio.h>
int main()
{
    char a;
    int b,sum;
    int num[9];
    while(scanf("%c",&a)!=EOF){
        scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d",num[0],&num[1],&num[2],&num[3],&num[4],&num[5],&num[6],&num[7],&num[8]);
        switch(a)
        {
        case'A':
            b=10;
            break;
        case'B':
            b=11;
            break;
        case'C':
            b=12;
            break;
        case'D':
            b=13;
            break;
        case'E':
            b=14;
            break;
        case'F':
            b=15;
            break;
        case'G':
            b=16;
            break;
        case'H':
            b=17;
            break;
        case'I':
            b=34;
            break;
        case'J':
            b=18;
            break;
        case'K':
            b=19;
            break;
        case'L':
            b=20;
            break;
        case'M':
            b=21;
            break;
        case'N':
            b=22;
            break;
        case'O':
            b=35;
            break;
        case'P':
            b=23;
            break;
        case'Q':
            b=24;
            break;
        case'R':
            b=25;
            break;
        case'S':
            b=26;
            break;
        case'T':
            b=27;
            break;
        case'U':
            b=28;
            break;
        case'V':
            b=29;
            break;
        case'W':
            b=32;
            break;
        case'X':
            b=30;
            break;
        case'Y':
            b=31;
            break;
        case'Z':
            b=33;
            break;
        }
        int c;
        int d;
        c =(b%10)*9;
        d =b/10;
        sum=d+c+num[0]*8+num[1]*7+num[2]*6+num[3]*5+num[4]*4+num[5]*3+num[6]*2+num[7]*1+num[8];
        if(sum%10==0)
            printf("real\n");
        else
            printf("fake\n");
    }
    return 0;
}
 
ZeroJudge Forum