Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3063 | 吴奕希 | 素数对 | C++ | Wrong Answer | 0 MS | 304 KB | 572 | 2024-03-30 18:05:15 |
# include<iostream> # include<cmath> using namespace std; bool isprimes[5000001]={}; int primes[5000001]={}; int n = 0, j = 0; int main(){ int x; cin>>x; for(int i = 2; i <= x; i++){ if(isprimes[i]==0){ primes[n]=i; n++; } j = 0; do{ isprimes[i*primes[j]]=1; if(i%primes[j]==0)break; j++; }while(i*primes[j]<=x); } for(int i = 0; i < n-1; i++)if(primes[i+1]-primes[i]==2)printf("%d %d\n", primes[i], primes[i+1]); return 0; }
------Input------
1
------Answer-----
No
------Your output-----