Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114847 | 吴诗涵 | 寻找绝对素数 | C++ | Compile Error | 0 MS | 0 KB | 867 | 2025-03-23 18:53:29 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int out(int x){ if(x<=1){ return 0; } for(int i=2;i*i<=x;i++){ if(x%i==0){ return 0; } } return 1; } int out_a(int y){ if(x<=1){ return 0; } int s=0; while(y!=0){ s=s*10+y%10; y/=10; } return out(s); } int main(){ int m,n,c=0,f=0; cin>>m>>n; for(int i=m;i<=n;i++){ if(out_a(i)&&out(i)){ if(f==0){ f++; cout<<i; } else{ cout<<','<<i; f++; } } } if(f==0){ cout<<"No"; } return 0; }
Main.cc: In function 'int out_a(int)': Main.cc:19:8: error: 'x' was not declared in this scope if(x<=1){ ^ Main.cc: In function 'int main()': Main.cc:30:9: warning: unused variable 'c' [-Wunused-variable] int m,n,c=0,f=0; ^