Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
118646 | 刘佳宇 | 素数对 | C++ | Accepted | 23 MS | 272 KB | 459 | 2025-05-09 19:06:41 |
#include<iostream> #include<cmath> using namespace std; bool sushu (int x){ for(int t=2;t<x;t++){ if(x%t==0){ return false; } } return true; } int main(){ int n,num=0,f=0; cin>>n; for(int i=2;i+2<=n;i++){ if(sushu(i)){ if(sushu(i+2)){ cout<<i<<" "<<i+2<<endl; num++; } } } if(num==0){ cout<<"No"; } return 0; }