kmhgk @ 2022-09-21 16:45:54
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
string s;
cin>>s;
int n=s.size();
int ans=0;
int a[10086]={};
int j=1;
for(int i=0;i<=n;i++){
if(s[i]>=48&&s[i]<=57){
ans=ans+(s[i]-'0')*j;
j++;
}
}
ans=ans%11;
if(ans==s[n]||((s[n]=='X')&&ans==10)){
cout<<"Right";
}else{
for(int i=0;i<=n-2;i++){
cout<<s[i];
}
if(ans==10){
cout<<'X';
}else{
cout<<ans;
}
}
return 0;
}
by ztntonny @ 2022-09-21 17:03:45
@kmhgk 您判断时用的不是最后一个号码,溢出了,求互关哦
by ztntonny @ 2022-09-21 17:04:29
@kmhgk 输入也多输入了
by kmhgk @ 2022-09-21 17:13:28
@ztntonny 谢谢大佬,已互关