Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132941 李馥甄 素数对 C++ Accepted 24 MS 272 KB 395 2025-10-12 17:29:09

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int n; bool sushu(int k){ if(k<2){ return false; } for(int i=2;i<=k/2;i++){ if(k%i==0){ return false; } } return true; } int main(){ cin>>n; if(n<5){ cout<<"No"; return 0; } for(int j=3;j<=n-2;j++){ if(sushu(j)==true){ if(sushu(j+2)==true){ cout<<j<<" "<<j+2<<endl; } } } return 0; }