Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132705 王金檐 素数对 C++ Wrong Answer 1 MS 268 KB 348 2025-10-12 10:48:10

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; bool sf (int i){ for(int l=2;l<i;l++){ if(i%l==0){ return 0; } } return 1; } int n,cut=0; int main(){ cin>>n; for(int i=2;i<=n;i++){ if(sf(i)==1){ if(sf(i+2)==1){ cout<<i<<" "<<i+2<<endl; cut++; } } } if(cut==0){ cout<<"No"; } return 0; }


Run Info:

------Input------
17
------Answer-----
3 5 5 7 11 13
------Your output-----
3 5 5 7 11 13 17 19