| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 138602 | 谭思宸 | 质数的和与积 | C++ | Compile Error | 0 MS | 0 KB | 613 | 2025-11-29 10:39:31 |
#include<iostream> #include<cmath> using namespace std; bool sushu(int n){ int j; if(n<=1) return False; for(j=2;j<=sqrt(n);j++){ if(n%j==0){ return False; } } return True; } int main(){ int i=0,j,num=0,n1=2,n2,max=0; int arr[20001]={0}; cin>>num; while(n1<=num/2){ n2=num-n1; if(sushu(n2)&&sushu(n1)){ if(max=n1*n2) max=n1*n2; } n1++; } cout<<max<<endl; return 0; }
Main.cc: In function 'bool sushu(int)':
Main.cc:7:27: error: 'False' was not declared in this scope
return False;
^
Main.cc:10:20: error: 'False' was not declared in this scope
return False;
^
Main.cc:13:12: error: 'True' was not declared in this scope
return True;
^
Main.cc: In function 'int main()':
Main.cc:22:29: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(max=n1*n2)
^
Main.cc:16:13: warning: unused variable 'i' [-Wunused-variable]
int i=0,j,num=0,n1=2,n2,max=0;
^
Main.cc:16:17: warning: unused variable 'j' [-Wunused-variable]
int i=0,j,num=0,n1=2,n2,max=0;
^
Main.cc:17:13: warning: unused variable 'arr' [-Wunused-variable]
int arr[20001]={0};
^