#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
int main()
{
int m,i,j,tmp;
bool panduan = true;
int a[17] = { 7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2 };
char b[11] = { '1','0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
string s;
vector<string> v;
cin >> m;
while (m--)
{
tmp = 0;
panduan = true;
cin >> s;
for (i = 0; i < 17; i++)
{
if (s[i] < 18 || s[i]>57)
{
panduan = false;
}
}
if (panduan == false)
{
v.push_back(s);
continue;
}
for (i = 0; i < 17; i++)
{
tmp += a[i] * (s[i] - 48);
}
tmp = tmp %11;
if (s[17] == b[tmp])
{
}
else
{
v.push_back(s);
}
}
if (v.size() != 0)
{
for (i = 0; i < v.size(); i++)
{
cout << v[i] << endl;
}
}
else
{
cout << "All passed";
}
return 0;
}
09-07
3776