Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114709 | 黎瑾萱 | 素数对 | C++ | Wrong Answer | 1 MS | 264 KB | 346 | 2025-03-23 11:40:58 |
#include <bits/stdc++.h> using namespace std; bool adj(int a){ for(int i=2;i<=sqrt(a);i++){ if(a%i==0){ return false; } } return true; } int main(){ int n; cin>>n; for(int i=2;i<=n;i++){ if(adj(i)){ if(adj(i+2) && i+2<=n){ cout<<i<<" "<<i+2<<endl; } } else{ cout<<"No"; } } return 0; }
------Input------
17
------Answer-----
3 5 5 7 11 13
------Your output-----
3 5 No5 7 NoNoNoNo11 13 NoNoNoNo