abundan @ 2024-01-24 14:25:34
#include <bits/stdc++.h>
using namespace std;
int main() {
int n=13,sum=0,k=1,m;
string s;
getline(cin,s);
for(int i=0;i<n-1;i++){
if(s[i]!='-'){
sum+=(s[i]-'0')*k;
k++;
}
}
m=sum%11;
if(m==(s[12]-'0'))printf("Right");
else{
s[12]=m+'0';
cout<<s;
}
return 0;
}
by Weekoder @ 2024-01-24 14:38:21
@abundan 已经改好了,求关注
没有考虑到
#include <bits/stdc++.h>
using namespace std;
int main() {
int n=13,sum=0,k=1,m;
string s;
getline(cin,s);
for(int i=0;i<n-1;i++){
if(s[i]!='-'){
sum+=(s[i]-'0')*k;
k++;
}
}
cerr << sum;
m=sum%11;
if(m==(s[12]-'0') || m == 10 && s[12] == 'X')printf("Right");
else{
s[12]=m+'0';
if (m == 10) s[12] = 'X';
cout<<s;
}
return 0;
}
by Weekoder @ 2024-01-24 14:39:30
那个 cerr << sum
你可以不用管
by abundan @ 2024-01-24 14:52:24
@Weekoder 谢谢已关