编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#101862 #105. zxh的继承顺位 Compile Error 0 0 ms 0 K C++ / 214 B u 2024-03-16 10:47:23
显示原始代码
int main() {
    int n, d, s, i;
    cin >> n;
    d = 0;
    for (i = 2;; i++) {
        s = 0;
        for (int j = 2; j <= sqrt(i); j++) {
            if (i % j == 0)
                s = 1;  //不是素数
        }
        if (s == 0) {
            d = d + 1;
        }
        if (d == n)
            break;
    }
    cout << i;
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:3:2: error: 'cin' was not declared in this scope
    3 |  cin>>n;
      |  ^~~
/sandbox/1/a.cpp:7:18: error: 'sqrt' was not declared in this scope
    7 |   for(int j=2;j<=sqrt(i);j++){
      |                  ^~~~
/sandbox/1/a.cpp:13:2: error: 'cout' was not declared in this scope
   13 |  cout << i;
      |  ^~~~