Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
118664 | 魏宏搏 | 素数对 | C++ | Accepted | 25 MS | 272 KB | 455 | 2025-05-09 22:58:10 |
#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; }