Gary084029 @ 2024-08-21 00:20:52
st= input()
k=0 #last number
i=0
n=0# 杠杠数
n1=0
for j in st:
if j=='-':
n+=1
if n==3:
break
if j!='-':
i+=1
k=k+int(j)*i
k=k%11
if str(k)==st[-1]:
print('Right')
else:
for i in st:
if i=='-':
n1+=1
if n1==3:
break
print(i,end='')
print('-%d'%k,end='')
by zhengyuxiang975 @ 2024-08-21 17:44:31
#include<bits/stdc++.h>
using namespace std;
long long s,j=1;
string a;
int main()
{
cin>>a;
for(int i=0;i<a.size()-1;i++)
{
if(a[i]!='-')
{
s+=(a[i]-'0')*j;
j++;
}
}
s=s%11;
if(s==(a[a.size()-1]-'0')||s==10&&(a[a.size()-1]=='X'))
cout<<"Right";
else
{
string a2=a.substr(0,a.size()-1);
cout<<a2;
if(s==10) cout<<"X";
else cout<<s;
}
return 0;
}
//密码=zhengyuxiang975