Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
84117 石茂诤 素数对 C++ Wrong Answer 0 MS 268 KB 455 2024-07-15 11:37:00

Tests(0/10):


Code:

# include<bits/stdc++.h> using namespace std; bool s(int a){ for(int j=2;j<sqrt(a);j++){ if(a%j==0){ return 0; } } return 1; } bool n(int b){ for(int j=2;j<sqrt(b);j++){ if(b%j ==0){ return 0; } } return 1; } int main(){ int m; cin>>m; if(m==1){ cout<<"No"; return 0; } for(int i=2;i<m-1;i++){ if(s(i)==1&&n(i+2)==1){ cout<<i<<' '<<i+2<<"\n"; } } return 0; }


Run Info:

------Input------
17
------Answer-----
3 5 5 7 11 13
------Your output-----
2 4 3 5 5 7 7 9 9 11 11 13