提交时间:2025-07-10 16:28:37

运行 ID: 330663

#include<bits/stdc++.h> using namespace std; bool isP(int x){ if(x<=1) return 0; if(x==2) return 1; for(int i=2; i*i<=x; i++){ if(x%i==0){ return 0; } } return 1; } int main(){ int n; cin>>n; for(int i=2; i<n-1; i++){ if(isP(i)){ if(isP(i+2)){ cout<<i<<" "<<i+2<<endl; } } } return 0; }