编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22199 #1007. G. 兼济天下 Compile Error 0 0 ms 0 K C / 794 B ZeroKelvin 2020-02-11 23:26:33
显示原始代码
#include <stdio.h>
#include <stdlib.h>

int main() {
    int T;
    scanf_s("%d", &T);
    int** List = (int**)malloc(T * sizeof(int*));
    for (int i = 0; i < T; i++) {
        List[i] = (int*)malloc(2 * sizeof(int));
    }
    for (int i = 0; i < T; i++) {
        scanf_s("%d%d", &List[i][0], &List[i][1]);
    }
    double q, r;
    for (int i = 0; i < T; i++) {
        int m = List[i][1];
        int n = List[i][0];
        q = (double)m / ((double)n - 1);
        if (m % (n - 1) == 0) {
            r = 0;
        } else {
            r = (n - 2) * (1 - (q - (int)q));
        }
        if (r > 0) {
            printf("%.6lf\n", r);
        } else {
            printf("CSFNB!\n");
        }
    }
    return 0;
}

编译信息

/sandbox/1/a.c:7:5: warning: implicit declaration of function 'scanf_s' is invalid in C99 [-Wimplicit-function-declaration]
    scanf_s("%d", &T);
    ^
1 warning generated.
/tmp/a-b8c50a.o: In function `main':
a.c:(.text+0x15): undefined reference to `scanf_s'
a.c:(.text+0x70): undefined reference to `scanf_s'
clang: error: linker command failed with exit code 1 (use -v to see invocation)