c++ 我真的服了,为啥在vs上至少能正确出样例,这里提交之后0分

P1055 [NOIP2008 普及组] ISBN 号码

Serend1pity @ 2022-12-11 22:56:49

#include<iostream>
using namespace std;
int main()
{
    string a;
    string end = "0123456789X";
    cin >> a;
    int sum = 0;
    int j = 1;
    for (int i = 0; i < 12; i++)
    {
        if (a[i] == '-') continue;
        sum += (a[i] - '0') * j;
        j = j++;
    }
    if (a[12] == end[sum % 11 ]) cout << "Right" << endl;
    else {
        a[12] = end[sum % 11 ]; cout << a << endl;
    }
    return 0;
}

by Zi_Gao @ 2022-12-11 23:19:05

你凭什么认为可以跑过样例,就一定对?


by Terrible @ 2022-12-12 00:07:24

j = j++》,似乎是未定义行为。


by mxdyzmx @ 2022-12-12 07:28:19

j=j++ 这位也是人才


by Creative_sad_yosgic @ 2022-12-13 20:46:38

“ j = j ++ ”


by Creative_sad_yosgic @ 2022-12-13 20:48:54

过样例0分不是很正常吗 还有什么是 j=j++


by whc2011 @ 2023-01-29 10:43:31

低级错误


|