编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#3270 #1006. 超级强迫症 Compile Error 0 0 ms 0 K C++ 17 / 396 B qwert 2023-11-25 14:28:38
显示原始代码
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    int N;
    int i = 0;

    scanf("%d", &N);
    int a[N];

    for (i = 0; i < N; i++) {
        scanf("%d", &a[i]);
    }

    for (i = 0; i < N - 1; i++) {
        if (a[i] != a[i + 1]) {
            printf("no\n");
            return 0;
        }
    }
    printf("yes\n");
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main(int, char**)':
/sandbox/1/a.cpp:9:2: error: 'scanf' was not declared in this scope
    9 |  scanf("%d",&N);
      |  ^~~~~
/sandbox/1/a.cpp:18:4: error: 'printf' was not declared in this scope
   18 |    printf("no\n");
      |    ^~~~~~
/sandbox/1/a.cpp:2:1: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
    1 | #include <stdlib.h>
  +++ |+#include <cstdio>
    2 | 
/sandbox/1/a.cpp:22:2: error: 'printf' was not declared in this scope
   22 |  printf("yes\n");
      |  ^~~~~~
/sandbox/1/a.cpp:22:2: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?