| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 130071 | 毛靖平 | 素数对 | C++ | Accepted | 11 MS | 264 KB | 410 | 2025-09-07 15:16:04 |
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int sum(int x){ int s=1; for(int i=2;i<=sqrt(x);i++){ if(x%i==0){ return 0; } } return 1; } int main(){ int n,c=0; cin>>n; for(int j=2;j<=n-2;j++){ if(sum(j)&&sum(j+2)){ cout<<j<<" "<<j+2<<endl; c++; } } if(c==0) cout<<"No"; return 0; }