Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140701 翁思宸 素数对 C++ Accepted 22 MS 268 KB 529 2025-12-19 18:41:41

Tests(10/10):


Code:

//1499 素数对 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int use(int x){ if(x<2){ return 0; } for(int i=2;i<=(x-1);i++){ if(x%i==0){ return 0; } } return 1; } int main(){ int n,s=0; cin>>n; for(int i=2;i<=(n-2);i++){ if(use(i)==1 && use(i+2)==1){ s++; cout<<i<<" "<<i+2<<endl; } } if(s==0){ cout<<"No"; } return 0; }