查验身份证
#include <stdio.h>
#include <string.h>
int main()
{
int N,i,j;
scanf("%d",&N);
char arr[N][20];
int sum;
int flag[100] = {0};
int brr[20] = {7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
int crr[20] = {1,0,10,9,8,7,6,5,4,3,2};
int cnt = 0;
for(i = 0;i<N;i++)
{
scanf("%s",arr[i]);
}
for(i = 0;i<N;i++)
{
sum = 0;
for(j = 0;j<17;j++)
{
sum = sum+(arr[i][j]-'0')*brr[j];
}
if(crr[sum%11] == arr[i][17]-'0' && arr[i][17]!='X')
{
cnt++;
flag[i] = 1;
}
else
{
if(sum%11 == 2 && arr[i][17] == 'X'){
cnt++;
flag[i] = 1;
}
}
}
if(cnt == N)
{
printf("All passed\n");
}
else
{
for(i = 0;i<N;i++)
{
if(flag[i] == 0)
{
printf("%s\n",arr[i]);
}
}
}
return 0;
}