Night_Leaf @ 2024-10-25 19:55:21
#include<bits/stdc++.h>
using namespace std;
string a;
int n=0,m=1;
int main(){
cin>>a;
for(int i=0;i<=a.size()-2;i++){
if(int(a[i])>=48&&int(a[i])<=57){
n+=(int(a[i])-48)*m;
m++;
}
}
n=n%11;
if(int(a[a.size()-1])-48==n)cout<<"Right";
else{
for(int i=0;i<=a.size()-2;i++)cout<<a[i];
if(n==10)cout<<'X';
else cout<<n;
}
return 0;
}
大佬能帮忙看看嘛
by 迟暮天复明 @ 2024-10-25 19:57:46
你没判原文末尾x
by Night_Leaf @ 2024-10-25 20:25:32
@迟暮天复明 老师,我在17行判断的不对吗?这里怎么改?
by 迟暮天复明 @ 2024-10-25 20:27:16
他输入最后一个x你是不是寄了就
by Night_Leaf @ 2024-10-25 21:02:21
@迟暮天复明 谢谢老师!
by gqccccc @ 2024-11-22 18:40:55
@Night_Leaf解决了吗
by Night_Leaf @ 2024-11-24 10:42:46
@gqccccc 解决啦,老师