- 2024西小秋学期第22-29次课1210.17.19.24.26.31.1.2
0
- 2024-12-17 17:04:19 @
#include<bits/stdc++.h> using namespace std; bool f(int x){ if(x<2) return 0; for(int i=2;i<=sqrt(x);i++) if(x%i0) return 0; return 1; } bool g(int x){ int ans=0; int tep=x; while(x);{ ans=ans*10+x%10; x/=10; } if(tepans) return 1; return 0; } int main(){ int n; cin>>n; if(f(n)&&g(n)) cout<<"prime"; else cout<<"not prime"; }
0 条评论
目前还没有评论...