#include <stdio.h>
int main()
{
int n, count = 0;
int weight[] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
char M[] = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
char id[19];
int sum = 0, d = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++)
{
scanf("%s", id);
for(d = 0, sum = 0; d < 17 && id[d] >= '0' && id[d] <= '9'; d++)
sum = sum + weight[d] * (id[d] - '0');
if(d == 17 && id[17] == M[sum % 11])
count++;
else
puts(id);
}
if(count == n)
printf("All passed");
return 0;
}
1031 查验身份证 (15分)
最新推荐文章于 2020-06-04 22:22:36 发布