Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3112 | 邓程允 | 寻找绝对素数 | C++ | Compile Error | 0 MS | 0 KB | 691 | 2024-04-05 16:31:05 |
# include<iostream> using namespace std; bool a(int n){ if(n=1||n=0)return false; for(int i=2;i<=n/i;i++){ if(n%i==0)return false; } return true; } int d(int n){ int e=0; while(n>0){ e=e*10+n%10; n/=10; } return e; } int main(){ int b,c,f[100001],g=0,h=0; cin>>b>>c; for(int i=b;i<=c;i++){ if(a(i)){ if(a(d(i))){ g=1; f[h]=i; h++; } } } if(g=0)cout<<"NO"; else { for(int i=0;i<h;i++){ cout<<f[i]; if(i!=h-1)cout<<","; } } return 0; }
Main.cc: In function 'bool a(int)': Main.cc:4:14: error: lvalue required as left operand of assignment if(n=1||n=0)return false; ^ Main.cc: In function 'int main()': Main.cc:30:11: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if(g=0)cout<"NO"; ^