Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
130070 毛靖平 素数对 C++ Wrong Answer 1 MS 268 KB 408 2025-09-07 15:14:47

Tests(0/10):


Code:

#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int sum(int x){ int s=1; for(int i=2;i<=sqrt(x);i++){ if(x%i==0){ return 0; } } return 1; } int main(){ int n,c=0; cin>>n; for(int j=2;j<=n-2;j++){ if(sum(j)&&sum(j)){ cout<<j<<" "<<j+2<<endl; c++; } } if(c==0) cout<<"No"; return 0; }


Run Info:

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