Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
118687 | 殷佳雨萱 | 素数对 | C++ | Accepted | 8 MS | 280 KB | 385 | 2025-05-10 10:01:48 |
#include <iostream> #include <cmath> using namespace std; bool a(int n){ for(int i=2;i*i<=n;i++) if(n%i==0) return false; return true; } int main(){ int n,s=0; cin>>n; for(int i=2;i<=n-2;i++){ if(a(i)&&a(i+2)){ s++; cout<<i<<' '<<i+2<<endl; } }if(s==0) cout<<"No"; return 0; }