问题标题: 酷町堂:1264 90分

0
0
已解决
孙轩
孙轩
修练者
修练者
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
bool js(int x)
{
    int j=2;
    while(j<sqrt(x)&&x%j!=0)j++;
    return j>sqrt(x);
}
int main()
{
    int n,i;bool q=1;
    cin>>n;   
    for(i=3;i<=n-2;i++) 
    if(js(i)==1&&js(i+2)==1)
    {
        cout<<i<<" "<<i+2<<endl;q=0;
    }
    if(q==1)cout<<"empty";
    return 0;
}

0
已采纳
包涵宇
包涵宇
中级天翼
中级天翼
 if(q==1)cout<<"empty";

这里错了,应该是这样:

if(q==1)cout<<"Error";

改过后可AC

望采纳!!!

0
0
0
0
我要回答