解题思路:
注意事项:
参考代码:
#include<iostream> #include<string> using namespace std; int main() { string str; int jud = 0; while (cin >> str) { int j = 1; jud = 0; for (int i = 0; i < str.size() - 1; i++) { if (i == 0 || (i > 1 && i < 5) || (i > 5 && i < 11)) jud = jud + (j++) * (str[i] - '0'); } int temp = jud % 11; if (temp == 10) { char temp = 'X'; if (temp == str[str.size() - 1]) cout << "Right" << endl; else cout << str.substr(0, str.size() - 1) << temp << endl; } else { if (temp == str[str.size() - 1] - '0') cout << "Right" << endl; else cout << str.substr(0, str.size() - 1) << temp << endl; } } return 0; }
0.0分
0 人评分
【出圈】 (C语言代码)浏览:554 |
A+B for Input-Output Practice (III) (C语言代码)浏览:570 |
WU-蓝桥杯算法提高VIP-企业奖金发放 (C++代码)浏览:1167 |
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:582 |
1009题解浏览:747 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:486 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:570 |
C二级辅导-计负均正 (C语言代码)浏览:480 |
Tom数 (C语言代码)浏览:555 |
输入输出格式练习 (C语言代码)浏览:847 |