Raccoon_Cookies @ 2023-09-14 22:44:44
膜拜各位大佬%%%,帮蒟蒻看看吧
#include<bits/stdc++.h>
using namespace std;
int main()
{
string ch;
getline(cin,ch);
int m=0;
for(int i=0;i<ch.size();i++)
{
if(ch[i]!='-')
m+=i*(ch[i]-'0');
}
m=m%11;
if(m-1==ch[ch.size()-1]-'0')
{
cout<<"Right"<<endl;
return 0;
}
else
ch[ch.size()-1]=m-1+'0';
cout<<ch;
return 0;
}
玄关,感谢
by Raccoon_Cookies @ 2023-09-14 22:45:24
一直输出right,连样例都没过
by Tachibana27 @ 2023-09-14 22:52:36
@Azure_qwq
m+=i*(ch[i]-'0');
第一位直接没了
by Raccoon_Cookies @ 2023-09-14 22:53:51
@xiaoluotongxue2012 那为啥我把每次m都输出还能对()
by YUwenzhao @ 2023-09-24 12:23:21
ZHIJIESHANG```cpp
using namespace std; char a[20]; int ans; int b[20]; int main() { int k=1; for (int i=1;i<=13;i++) { cin>>a[i]; if (a[i]!='-') { b[k]=a[i]-'0'; k++; } } for (int i=1;i<=9;i++) { ans+=b[i]*i; ans=ans%11; } char z; if (ans==10) z='X'; else z=char(ans+'0'); if (z==a[13]) cout<<"Right"; else { a[13]=z; for (int i=1;i<=13;i++) cout<<a[i]; } return 0; }