Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
130364 谭思宸 素数对 C++ Accepted 12 MS 272 KB 440 2025-09-13 11:17:32

Tests(10/10):


Code:

#include<iostream> #include<cmath> using namespace std; bool ZS(int x){ for(int i=2;i<=sqrt(x);i++){ if(x%i==0){ return false; } } return true; } int main(){ int n; int flag=0; cin>>n; for(int i=2;i+2<=n;i++){ if(ZS(i)&&ZS(i+2)){ cout<<i<<" "<<i+2<<endl;; flag++; } } if(flag==0)cout<<"No"<<endl; return 0; }