蒟蒻求教 只有59分 但是wa的测试点都是对的

P1055 [NOIP2008 普及组] ISBN 号码

POOS @ 2023-10-22 09:57:55

#include <stdio.h>
#include <math.h>
int main() {
    int a, b, c;
    char d;
    scanf("%d-%d-%d-%c", &a, &b, &c, &d);
    int sum = 0;
    sum += a;
    for (int i = 2; i < 5; i++) {
        int n = b;
        int temp = n % 10;
        sum += (temp * i);
        n /= 10;
    }
    for (int i = 5; i < 10; i++) {
        int n = c;
        int temp = n % 10;
        sum += (temp * i);
        n /= 10;
    }
    int mid = sum % 11;
    char arr[11] = "0123456789X";
    if (d == arr[mid])
        printf("Right");
    else
        printf("%d-%d-%d-%c", a, b, c, arr[mid]);

    return 0;
}

by lindehao @ 2023-10-22 10:06:42

《WA的测试点是AC的》


|