测试4和8不通过,在vs上4能正常输出

P1055 [NOIP2008 普及组] ISBN 号码

starlgc @ 2022-11-03 17:44:51

。。。救救孩子把```cpp

include<iostream>

include<string>

using namespace std; int main() { string ISBN; getline(cin, ISBN); int len = ISBN.size(); int all=0; int lu = 0; for (int i = 0; i < len-1; i++) {

    if (ISBN[i] == '-') { lu++; continue; }
    all += (ISBN[i]-'0') * (i - lu + 1);

}
int res = all % 11;
if (res == 10) {
    if (ISBN[len - 1] == 'X') { cout << "Right"; return 0; }
    else {
        for (int j = 0; j < len - 1; j++) {

            cout << ISBN[j];

        }
        cout << 'X'; return 0;
    }

}
if (all % 11 == (ISBN[len - 1]-'0')) {

    cout << "Right";
}
else {

    for (int j = 0; j < len - 1; j++) {

        cout << ISBN[j];

    }

    cout << res;
}

return 0;

}


by Xy_top @ 2022-11-03 17:46:22

LATEX炸了啊


by 老官童鞋gogo @ 2022-11-03 17:54:21

您的Markdown爆炸了


by starlgc @ 2022-11-03 18:22:42

@老官童鞋gogo 请问一下如果要改的话该怎么改呢,感谢


by starlgc @ 2022-11-03 18:22:53

@stdios 请问一下如果要改的话该怎么改呢,感谢


by 老官童鞋gogo @ 2022-11-04 10:12:33

@starlgc 您可以在预览界面确认无误后再发布,或者网上查找有关Markdown的教程(很简单)


|