@[hardworking_potato](/user/300961) 请问如果wch[12]=='X'怎么办?
by HyyypRtf06 @ 2020-02-25 17:25:29
@[HyyypRtf06](/user/315602)
谢谢!改了这里之后确实多了20分(捂脸.jpg
但是第二个点我下载之后答案是对的系统给了WA
```cpp
#include <iostream>
using namespace std;
int main(){
char wch[13];
cin >> wch;
int xss = (wch[0] - 48) +
(wch[2] - 48) * 2 +
(wch[3] - 48) * 3 +
(wch[4] - 48) * 4 +
(wch[6] - 48) * 5 +
(wch[7] - 48) * 6 +
(wch[8] - 48) * 7 +
(wch[9] - 48) * 8 +
(wch[10] - 48) * 9;
int a = xss % 11;
if((a == wch[12] - 48) || (a == 10 && wch[12] == 'X')){
cout << "Right";
return 0;
}
else{
if(a == 10)
wch[12] = 'X';
else
wch[12] = a + 48;
}
cout << wch;
return 0;
}
```
by hardworking_potato @ 2020-02-25 21:07:24
@[hardworking_potato](/user/300961) 还有就是你的数组开大一点【因为系统会在后面加上'\0',您越界了qvq】
by HyyypRtf06 @ 2020-02-26 12:28:39