Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
84167 石茂诤 寻找绝对素数 C++ Wrong Answer 27 MS 272 KB 455 2024-07-15 12:04:38

Tests(1/10):


Code:

# include<bits/stdc++.h> using namespace std; bool s(int a){ for(int j=2;j<a;j++){ if(a%j==0){ return 0; } } return 1; } int fx (int a){ int m=0; while(a>0){ m=m*10+a%10; a=a/10; } return m; } int main(){ int n,m,k,f=0; cin>>m>>n; for(int i=m;i<n;i++){ k=fx(i); if(s(i)&&s(k)){ if(f==0){ cout<<i; f=1; } else{ cout<<','<<i; } } } return 0; }


Run Info:

------Input------
1 10
------Answer-----
2,3,5,7
------Your output-----
1,2,3,5,7