145a @ 2024-02-25 19:23:19
555就差第一个WA其他都AC了
#include <iostream>
#include <string>
using namespace std;
int main()
{
string isbn, isbnWithoutIdCode;
char testIdCode;
int index = 1, idCodeCount = 0;
getline(cin, isbn);
isbnWithoutIdCode = isbn.substr(0, 11);
testIdCode = isbn.at(12);
for (char ¤tChar: isbn.substr(0, 11))
{
if (currentChar == '-') continue;
int currentNum = currentChar - '0';
idCodeCount += index * currentNum;
index += 1;
}
idCodeCount %= 11;
if (idCodeCount == 10)
{
cout << (testIdCode == 'X' ? "Right" : isbnWithoutIdCode + "-X");
}
else
{
cout << (testIdCode == idCodeCount ? "Right" : isbnWithoutIdCode + "-" + to_string(idCodeCount));
}
}
by QuQ_ @ 2024-02-25 20:13:49
@145a 建议打表
by xk2013 @ 2024-02-26 21:53:00
@145a 这么标准的英文单词,你确定不是 ChatGPT 写的
by lmxi @ 2024-02-26 22:21:06
@145a
这种English的标准程度是一个普通人难以想象的
by wumoumou_tyxx @ 2024-03-13 21:18:09
@byoi23_0599 没错