各位老师,请教代码错误的地方,只有80分

P1055 [NOIP2008 普及组] ISBN 号码

yxpxa @ 2021-09-20 21:35:27

#include <iostream>
#include <string>
using namespace std;
int main() {
    string s, c = "0123456789X";
    int i, j = 1, m = 0;
    cin >> s;
    for (i = 0; i < 11; i++)
        if ((s[i]) > 47 && s[i] < 58) m += ((int)s[i] - 48) * j++;
    if (s[12] == c[m % 11])
        s = "Rigth";
    else
        s[12] = c[m % 11];
    cout << s;
    return 0;
}

by Ritel @ 2021-09-20 21:36:53

Rigth


by dxy2020 @ 2021-09-20 21:37:59

s = "Rigth";

by Ritel @ 2021-09-20 21:40:52

@yxpxa 还有,大可不必叫“老师”,这里都是亲切可爱的同学们


by dxy2020 @ 2021-09-20 21:41:11

@Little_Down 是的


by yxpxa @ 2021-09-20 21:41:59

@Little_Down @小小蒟蒻一只 哦哦,单词错误,这太不应该了。


by yxpxa @ 2021-09-20 21:42:59

@Little_Down 子曰:三人行必有我师。


|