@[Coffee_Moew](/user/1051270) 最后要判断一下 `sdm == 10`
by ForgotDream_CHN @ 2023-08-01 10:42:01
@[Coffee_Moew](/user/1051270)
还有 `sbm` 要初始化
```cpp
#include<bits/stdc++.h>
using namespace std;
int main()
{
string isbn;
int sbm = 0,sl=1;
cin>>isbn;
for(int i=0;i<isbn.size()-1;i++)
if(isbn[i]!='-')
{
sbm=sbm+(isbn[i]-'0')*sl;
sl++;
}
sbm=sbm%11;
if(isbn[isbn.size()-1]-'0'==sbm||(isbn[isbn.size()-1]=='X'&&sbm==10)) cout<<"Right";
else
{
for(int i=0;i<isbn.size()-1;i++) cout<<isbn[i];
cout<<(sbm == 10 ? (char)'X' : char(sbm + '0'));
}
return 0;
}
```
by ForgotDream_CHN @ 2023-08-01 10:49:31
@[ForgotDream_CHN](/user/750067) 谢大佬,已关
by Coffee_Moew @ 2023-08-01 10:55:35