好像是计算出错,但没看出来

P1055 [NOIP2008 普及组] ISBN 号码

'\b'这种偷鸡的写法是不行的 这样就行了 ```cpp #include <iostream> #include <string> using namespace std; int main() { string str; int all = 0,j = 0; cin >> str; for (int i = 0; i <= 11; i++) { if (str[i] != '-') { j++; all += int(str[i] - '0') * j; } } all %= 11; if (all == (str[12] - '0')||(all == 10 && str[12] == 'X')) cout << "Right"; else if( all == 10) { for (int i = 0; i <= 11; i++) cout << str[i]; cout << "X" << endl; } else { for (int i = 0; i <= 11; i++) cout << str[i]; cout << all << endl; } return 0; } ```
by xuyao35 @ 2024-01-22 22:01:07


@[xuyao35](/user/1122193) 谢谢,解决了。看来对于洛谷的机制还是得好好研究一下。
by codecolorThD @ 2024-01-23 21:39:13


|