Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95204 | 黎瑾萱 | 素数对 | C++ | Wrong Answer | 1 MS | 272 KB | 356 | 2024-10-27 10:07:00 |
#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 0; } } return 1; } int main(){ int flag=0; int n,count=0; cin>>n; for(int i=2;i<=n-2;i++){ if(ssd(i)==1&&ssd(i+2)==1){ cout<<i<<" "<<i+2<<endl; } } if(flag==0){ cout<<"No"; } return 0; }
------Input------
17
------Answer-----
3 5 5 7 11 13
------Your output-----
3 5 5 7 11 13 No