Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138574 吕毅心 素数对 C++ Wrong Answer 1 MS 272 KB 660 2025-11-28 18:15:14

Tests(0/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int s(int z){ int sum=0,c=0; for(int i=2;i<z;i++){ if(z%i==0){ break; }else{ sum+=1; } } if(sum==z-2){ c+=1; } return c; } int main(){ int n,sum=0; cin>>n; for(int i=2;i<=n+2;i++){ if(s(i)+s(i+2)==2){ cout<<i<<" "<<i+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