Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
24217 | yihang | 统计单词数 | C++ | 解答错误 | 0 MS | 240 KB | 456 | 2023-07-21 20:34:34 |
#include"bits/stdc++.h" using namespace std; int s(int x){ if(x==1)return false; for(int i=2;i*i<=x;i++){ if(x%i==0)return false;} return true;} int main(){ long long n; cin>>n; if(s(n)){ if(s(n-6)){ cout<<"Yes"<<endl<<n-6; return 0;} if(s(n+6)){ cout<<"Yes"<<endl<<n+6; return 0;}} else{ cout<<"No"<<endl; while(n++){ if(s(n)&&s(n-6)&&n-6>0){ cout<<n; return 0;} if(s(n)&&s(n+6)){ cout<<n; return 0;} }} }