#不知道为什么编译不成功,在vs里却可以成功运行

P1055 [NOIP2008 普及组] ISBN 号码

street_of_wind @ 2022-05-29 14:44:55

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
int main()
{
    int i = 0;
    int j = 0;
    int all = 0;
    char num[20];
    char arr[20] = { 0 };
    int max[20];
    scanf("%s", &num);
    int size = strlen(num);

    for (i = 0; i <= 13; i++)
    {
        if (num[i] == '-')
        {
            j++;
        }
        else
        {
            arr[i-j] = num[i];
        }
    }

    j = 0;
    for (i = 1; i < 10; i++)
    {
        max[i-1] = (arr[i-1]-'0') * i;
    }

    all = max[0] + max[1] + max[2] + max[3] + max[4] + max[5] + max[6] + max[7] + max[8];

    if (all % 11+'0' == arr[9])
    {
        printf("Right");
    }
    else
    {
        num[12] = all % 11+'0';
        for (i = 0; i < size; i++)
       {
            printf("%c", num[i]);
        }
    }
    return 0;
}

by Mystic_duck @ 2022-05-29 14:47:40

把#define _CRT_SECURE_NO_WARNINGS删了


by fengjinyonghu @ 2022-05-29 14:47:40

然而我这里编译成功了


by street_of_wind @ 2022-07-31 12:02:22

解出来了 谢谢大家


|