_sangxiao_ @ 2024-06-29 17:15:40
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int len,tep=0,sun=0,mod=11;
cin>>s;
for(int i=0;i<11;i++){
if(s[i]!='-'){
int num=s[i]-'0';
sun+=num*++tep;
sun%=mod;
}
}
int than=s[12]-'0';
s[12]=sun+'0';
if(sun==than) cout<<"Right";
else cout<<s;
return 0;
}
by _sangxiao_ @ 2024-06-29 17:16:21
@leixiuzi
只有50分
by CuFeO4 @ 2024-06-29 17:34:51
如果余数为 10,则识别码为大写字母 ‘X’。
by CuFeO4 @ 2024-06-29 17:35:26
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int len,tep=0,sun=0,mod=11;
cin>>s;
for(int i=0;i<11;i++){
if(s[i]!='-'){
int num=s[i]-'0';
sun+=num*++tep;
sun%=mod;
}
}
int than = (s[12] == 'X'?10:s[12]-'0');
s[12] = (sun == 10?'X':sun+'0');
if(sun==than) cout<<"Right";
else cout<<s;
return 0;
}