| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 78954 | 杨宜炜 | 求和 | C++ | Compile Error | 0 MS | 0 KB | 684 | 2024-06-29 15:30:46 |
#include<iostream> using namespace std; int zs(int n){ if(n<2){ return 0; } if(n==2){ return 1; } if(n%2==0){ return 0; } for(int i=3;i<n;i+=2){ if(n%i==0){ return 0; } } return 1; } int main(){ int n,m,sum=0; cin>>n>>m; for(int i=n;i<=m;i++){ if(zs(i)==1){ sum++; } } cout<<sum; }#include<iostream> using namespace std; int zs(int n){ if(n<2){ return 0; } if(n==2){ return 1; } if(n%2==0){ return 0; } for(int i=3;i<n;i+=2){ if(n%i==0){ return 0; } } return 1; } int main(){ int m,sum=0; cin>>m; for(int i=4;i<=m;i++){ if(zs(i)==0){ sum+=i; } } cout<<sum; }
Main.cc:29:2: error: stray '#' in program
}#include
^
Main.cc:29:3: error: 'include' does not name a type
}#include
^
Main.cc: In function 'int zs(int)':
Main.cc:31:5: error: redefinition of 'int zs(int)'
int zs(int n){
^
Main.cc:3:5: note: 'int zs(int)' previously defined here
int zs(int n){
^
Main.cc: In function 'int main()':
Main.cc:48:5: error: redefinition of 'int main()'
int main(){
^
Main.cc:20:5: note: 'int main()' previously defined here
int main(){
^