B1031

#include<iostream>
using namespace std;
int main(){
int n,no=0,flag,tot;
string s;
cin>>n;
int arr[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
char brr[11]={'1','0','X','9','8','7','6','5','4','3','2'};
for(int i=0;i<n;i++){
cin>>s;
tot=0;
flag=0;
for(int j=0;j<s.length()-1;j++){
if(s.length()==18&&s[j]-'0'<=9&&s[j]-'0'>=0)
tot+=(s[j]-'0')*arr[j];
else{
no++;
cout<<s<<endl;
flag=1;
break;
}
}
if(!flag&&brr[tot%11]!=s[s.length()-1]){
no++;
cout<<s<<endl;
}
}
if(!no)
cout<<"All passed";
return 0;
}

猜你喜欢

转载自www.cnblogs.com/tao7/p/9769066.html