Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140762 任艺宸 寻找绝对素数 C++ Wrong Answer 1 MS 264 KB 637 2025-12-20 12:22:36

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; bool z(int n) { if(n<=1)return false; for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } int main(){ int n,x=0; cin>>n; for(int i=2;i<=n-2;i++){ if(z(i)&&z(i+2)){ x++; cout<<i<<" "<<i+2<<endl; } } if(x==0){ cout<<"No"<<endl; } return 0; }


Run Info:

------Input------
1000 10999
------Answer-----
1009,1021,1031,1033,1061,1069,1091,1097,1103,1109,1151,1153,1181,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1279,1283,1301,1321,1381,1399,1409,1429,1439,1453,1471,1487,1499,1511,1523,1559,1583,1597,1601,1619,1657,1669,1723,1733,1741,1753,1789,1811,1831,1847,1867,1879,1901,1913,1933,1949,1979,3011,3019,3023,3049,3067,3083,3089,3109,3121,3163,3169,3191,3203,3221,3251,3257,3271,3299,3301,3319,3343,3347,3359,3371,3373,3389,3391,3407,3433,3463,3467,3469,3511,3527,3541,3571,3583,3613,3643,3697,
------Your output-----
3 5 5 7 11 13 17 19 29 31 41 43 59 61 71 73 101 103 107 109 137 139 149 151 179 181 191 193 197 199 227 229 239 241 269 271 281 283 311 313 347 349 419 421 431 433 461 463 521 523 569 571 599 601 617 619 641 643 659 661 809 811 821 823 827 829 857 859 881 883