Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
91366 | 孙嘉言 | 素数对 | C++ | Wrong Answer | 1 MS | 264 KB | 324 | 2024-09-21 16:59:56 |
#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;i++){ if(a(i)&&a(i+2)) cout<<i<<' '<<i+2<<endl; } return 0; }
------Input------
17
------Answer-----
3 5 5 7 11 13
------Your output-----
3 5 5 7 11 13 17 19