@[cyzyyds122](/user/1045037) 我看看,请稍等
by Robots75 @ 2023-09-26 21:42:33
@[cyzyyds122](/user/1045037) 你是不是忘了样例2了啊?
by Robots75 @ 2023-09-26 21:46:34
@[cyzyyds122](/user/1045037) 样例2你的会错,原因是你没有输出正确的ISBN 号码。
by Robots75 @ 2023-09-26 21:48:20
@[cyzyyds122](/user/1045037) 具体就是pove函数最后一行处理一下就行了
by Robots75 @ 2023-09-26 21:49:04
@[cyzyyds122](/user/1045037)
奉上本蒟蒻的代码
```cpp
#include<bits/stdc++.h>
using namespace std;
string a;
int main(){
cin>>a;
int sum=0,j=0;
for(int i=0;i<a.length()-1;i++)//计算到倒数第二位
if(a[i]>='0'&&a[i]<='9')
sum+=(a[i]-'0')*(++j);
if(sum%11==10){
if(a[a.length()-1]=='X'){printf("Right");return 0;}
else{
a.pop_back();cout<<a;
cout<<'X';
return 0;
}
}
if(a[a.length()-1]-'0'==(sum%11)){printf("Right");return 0;}
else {
a.pop_back();cout<<a;
cout<<sum%11;
}
return 0;
}
```
嘤嘤嘤,别抄,参考一下
by Robots75 @ 2023-09-26 21:50:09
```cpp
#include<bits/stdc++.h>
using namespace std;
int sum = 1,add,last,total;
char memory[11];
int main(){
while(sum <= 10){
char ch;
cin >> ch;
if(sum <= 9) memory[total++] = ch;
if(ch != '-'){
if(sum <= 9) add = add + (ch - '0') * sum;
else{
if(ch != 'X') last = ch - '0';
else last = 10;
}
sum++;
}
}
if(last == add % 11) cout << "Right";
else{
for(int i = 0;i < 11;i++) cout << memory[i];
cout << '-';
if(add % 11 == 10) cout << 'X';
else cout << add % 11;
}
}
```
by CooooldWind_ @ 2023-09-26 21:57:13
@[Robots75](/user/1021365) 感谢大佬
我写代码的时候做错了,以为是原样输出。。。
by cyzyyds122 @ 2023-09-27 19:10:16