17 条题解

  • -1
    @ 2023-12-20 20:03:24
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e4+10;
    int n,flag;
    bool f(int x){
    	if(x<2) return 0;
    	for(int i=2;i<=sqrt(x);i++) if(x%i==0) return 0;
    	return 1;
    }
    int main()
    {
    	cin>>n;
    	for(int i=2;i<=n;i++){
    		if(f(i)&&f(i+2)&&i+2<=n){
    			flag=1;
    			cout<<i<<" "<<i+2<<endl;
    		}
    	}
    	if(!flag)
    		cout<<"empty";
    	return 0;
    }
    

    信息

    ID
    946
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    (无)
    递交数
    1067
    已通过
    295
    上传者