1043素数对

 1 #include<iostream>
 2 using namespace std;
 3 bool iss(int x)
 4 {
 5     for(int i=2;i*i<=x;i++)
 6     {
 7         if(x%i==0)return false;
 8     }
 9     return true;
10 }
11 int main()
12 {
13     int n;
14     bool isempty=true;
15     cin>>n;
16     for(int i=2;i<=n-2;i++)
17     {
18         if(iss(i)&&iss(i+2))
19         {
20          isempty=false;
21          cout<<i<<" "<<i+2<<endl;    
22         }
23     }
24     if(isempty)cout<<"empty";
25     return 0;
26 }

 

posted @ 2017-12-04 23:23  TFLSNOI  阅读(163)  评论(0编辑  收藏  举报