| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 144761 | 田祥江 | 判断素数II | C++ | Compile Error | 0 MS | 0 KB | 267 | 2026-01-24 17:36:08 |
#include<bits/stdc++.h> using namespace std; bool a(int b){ for(int i=2;i<=sqrt(b);i++){ if(a%i==0) return 0; } return 1; } int main() { int n,sum=0; cin>>n; for(int i=2;i<=n;i++){ if(a(i)) sum++; } cout<<sum; return 0; }
Main.cc: In function 'bool a(int)':
Main.cc:6:8: error: invalid operands of types 'bool(int)' and 'int' to binary 'operator%'
if(a%i==0) return 0;
^