Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
98561 王思颜 素数对 C++ Wrong Answer 1 MS 272 KB 361 2024-11-23 11:33:57

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int he(int b){ if (b < 2){ return 0; } for (int i = 2;i < b;i++){ if (b % i == 0){ return 0; } } return 1; } int main(){ int n,a,b; cin>>n; for (int j = 2;j <= n;j++){ a = he(j); b = he(j + 2); if (a == 1 && b == 1){ cout<<j<<" "<<j + 2<<endl; } } return 0; }


Run Info:

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