Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117978 | 郝王骏程 | 素数对 | C++ | Accepted | 39 MS | 272 KB | 460 | 2025-04-21 20:03:35 |
#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; }