#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int w[17] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };
char M[11] = { '1','0','X','9','8','7','6','5','4','3','2' };
int main() {
int N;
int count = 0;
cin >> N;
int temp = N;//N无法与count直接比较
string str;
while (N--) {
bool flag = true;
int weight = 0;
cin >> str;
for (int i = 0; i < str.length()-1; i++) {
if (!isdigit(str[i])) flag = false;
weight = weight + (str[i] - '0') * w[i];
}
if (M[weight%11]!=str[str.length()-1]) flag = false;
if (flag == false) cout << str << endl;
else count++;
}
if (count == temp) cout << "All passed";
return 0;
}
1031 Check ID card (15 分)
于 2022-01-18 00:43:56 首次发布