#29383: C語言解答


tanthony4320@gmail.com (斌)

學校 : 不指定學校
編號 : 184089
來源 : [140.114.40.187]
最後登入時間 :
2022-02-22 11:48:38
a020. 身分證檢驗 | From: [140.114.40.187] | 發表日期 : 2022-02-22 11:53

#include<stdio.h>
char m[256];
char a;
char num[10];
int main(void){
   
    m['A'] = 10, m['B'] = 11, m['C'] = 12, m['D'] = 13,
    m['E'] = 14, m['F'] = 15, m['G'] = 16, m['H'] = 17,
    m['I'] = 34, m['J'] = 18, m['K'] = 19, m['L'] = 20,
    m['M'] = 21, m['N'] = 22, m['O'] = 35, m['P'] = 23,
    m['Q'] = 24, m['R'] = 25, m['S'] = 26, m['T'] = 27,
    m['U'] = 28, m['V'] = 29, m['W'] = 32, m['X'] = 30,
    m['Y'] = 31, m['Z'] = 33;
   
    scanf("%c",&a);
    for(int i=0;i<9;i++){
        scanf("%c",&num[i]);
    }
   
    int sum;
    sum=((m[a]/10)+(m[a]%10)*9+(num[0]-48)*8+(num[1]-48)*7+(num[2]-48)*6+(num[3]-48)*5+(num[4]-48)*4+(num[5]-48)*3+(num[6]-48)*2+(num[7]-48)*1+num[8]-48);

    if(sum%10==0){
        printf("real");
    }else{
        printf("fake");
    }

    return 0;
}
 
ZeroJudge Forum