遇事不决就选C @ 2022-06-29 18:46:54
我这个代码90分,最后一题数据下载下来和我答案一模一样,求各位大佬告诉我怎么改。
by 拾然z @ 2022-06-29 18:50:34
您代码呢?
by 遇事不决就选C @ 2022-06-29 18:51:49
#include <bits/stdc++.h>
using namespace std;
string a;
int cnt, b = 1;
int main() {
getline(cin, a);
for (int i = 0; i < a.size() - 2; i++) {
if (a[i] == '-') continue;
cnt = cnt + ((int)a[i] - '0') * b;
b++;
}
cnt = cnt % 11;
if (cnt == (int)a[12] - '0' && a[12] != 'X') cout << "Right";
else if (a[12] == 'X' && cnt == 10) cout << "Right";
else {
for (int i = 0; i < a.size() - 1; i++) cout << a[i];
if (cnt == 10) cout << "X";
else if (cnt != 10) cout << cnt;
}
return 0;
}
by 遇事不决就选C @ 2022-06-29 18:52:36
这里
by 遇事不决就选C @ 2022-06-29 18:54:09
@拾然z 帮我看看,谢谢
by 遇事不决就选C @ 2022-06-29 18:55:20
@拾然z oh,紫题大佬
by 拾然z @ 2022-06-29 18:56:39
太巧了看了一下我也是90
by 拾然z @ 2022-06-29 18:58:33
@遇事不决就选C 感觉逻辑没问题
by 遇事不决就选C @ 2022-06-29 18:58:46
@拾然z 真的是太巧了
by 遇事不决就选C @ 2022-06-29 18:59:06
@拾然z 雀食
by 拾然z @ 2022-06-29 18:59:38
@遇事不决就选C 检查一下大小写或者有没有多的空格?(这也可能没