Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95195 | 黎瑾萱 | 素数对 | C++ | Wrong Answer | 1 MS | 272 KB | 306 | 2024-10-27 10:00:42 |
#include<bits/stdc++.h> using namespace std; bool ssd(int a){ int s=0; for(int i=2;i<a;i++){ if(a%i==0){ return s; } } return 1; } int main(){ int n,count=0; cin>>n; for(int i=2;i<=n;i++){ if(ssd(i)==1&&ssd(i+2)==1){ 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