This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdlib.h> | |
int main(){ | |
int n; | |
scanf("%d",&n); | |
while(n--){ | |
char arr[13]; | |
scanf("%s",arr); | |
int num=0,weight[]={1,3,5,2,4,6,1,3,5,2,4,6},i=0; | |
for(;i<12;i++){ | |
num+=(arr[i]-'0')*weight[i]; | |
} | |
if(10-(num%10)==arr[12]-'0') | |
printf("yes\n"); | |
else | |
printf("no\n"); | |
} | |
/*題目:C_AR90-易 天堂島居留證 | |
作者:1010 | |
時間:西元 2017 年 4 月*/ | |
} |
這題用java交了21次始終回傳值1我也搞不懂問題在哪(但有人java繳交AC),最後索性用C寫竟然一次就過= =
這題就跟身分證檢驗類似,依照他的說明權重運算與最後一位相同就輸出yes反之
沒有留言:
張貼留言