80分!思路没问题!大佬求解!

P1055 [NOIP2008 普及组] ISBN 号码

解决了没有考虑到识别码为本来就为X的情况,谢谢大佬 ```cpp if(ans%11==a[10]||(ans%11==10&&ch[13]=='X')){ cout<<"Right"; return 0; ```
by XiMeng_2077 @ 2023-08-01 22:48:51


``` #include<iostream> #include<cstring> using namespace std; int main(){ string a; cin>>a; int s=(a[0]-'0')*1+(a[2]-'0')*2+(a[3]-'0')*3+(a[4]-'0')*4+(a[6]-'0')*5+(a[7]-'0')*6+(a[8]-'0')*7+(a[9]-'0')*8+(a[10]-'0')*9; s%=11; if(s==10&&a[12]=='X')cout<<"Right"; if(s<10&&s==a[12]-'0')cout<<"Right"; if(s==10&&a[12]!='X'){ a[12]='X'; cout<<a; } if(s<10&&s!=a[12]-'0'){ a[12]=s+'0'; cout<<a; } } ```
by zhanghe724_1 @ 2023-08-04 14:58:38


|