#include<stdio.h>
int main(void) {
int a,b,c,first;
int n[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};
char id[10];
while(scanf("%s",id)!=EOF) {
a=b=c=0;
first=n[id[0]-65];
a=first/10+first%10*9;
for(int i=1;i<=8;i++)
b+=((int)id[i]-48)*(9-i);
c=id[9]-48;
if(!((a+b+c)%10)) printf("real\n");
else printf("fake\n");
}
}
433bytes
#include
int main(void) {
int a,b,c,first;
int n[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};
char id[10];
while(scanf("%s",id)!=EOF) {
a=b=c=0;
first=n[id[0]-65];
a=first/10+first%10*9;
for(int i=1;i<=8;i++)
b+=((int)id[i]-48)*(9-i);
c=id[9]-48;
if(!((a+b+c)%10)) printf("real\n");
else printf("fake\n");
}
}
433bytesk
請問這有抓大小寫錯誤 或於數字間輸入英文之錯誤嗎??
請問這有抓大小寫錯誤 或於數字間輸入英文之錯誤嗎??
以這題來說,測資都照格式 (先英文後 9 個數字) 輸入,且英文都大寫