遇事不决就选C @ 2022-06-29 18:46:54
我这个代码90分,最后一题数据下载下来和我答案一模一样,求各位大佬告诉我怎么改。
by 遇事不决就选C @ 2022-06-29 19:00:31
emmm,空格肯定是没,大小写康一眼
by _Kouki_ @ 2022-06-29 19:02:27
建议 使用 char 数组,我似乎被这玩意坑过
by _Kouki_ @ 2022-06-29 19:05:23
@遇事不决就选C 通过我上述的方法即可AC,顺便给个关注呗
by _Kouki_ @ 2022-06-29 19:06:42
#include <bits/stdc++.h>
using namespace std;
char a[15];
int cnt, b = 1;
int main() {
cin>>a;
for (int i = 0; i < strlen(a) - 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 < strlen(a) - 1; i++) cout << a[i];
if (cnt == 10) cout << "X";
else if (cnt != 10) cout << cnt;
}
return 0;
}
by 遇事不决就选C @ 2022-06-29 19:08:00
@Kouki 点了,大佬能不能回关·-·
by 遇事不决就选C @ 2022-06-29 19:11:29
@Kouki 咱们今年可能在csp-J国赛碰上诶,我预测我是三等奖
by _Kouki_ @ 2022-06-29 19:15:35
@遇事不决就选C 你WHの?
by _Kouki_ @ 2022-06-29 19:16:12
@Kouki 不指 武汉
by 遇事不决就选C @ 2022-06-29 19:17:26
@Kouki wh是什么hh·-·
by _Kouki_ @ 2022-06-29 19:18:10
@遇事不决就选C 那你为什么说会碰到,搞得我很懵逼 ,还有 WH -> 芜湖