为什么是80分啊?
查看原帖
为什么是80分啊?
744858
GalaxyDeepLove楼主2023/1/29 14:28

`cpp

#include <bits/stdc++.h>
using namespace std;

inline bool prime(int x){
    if(x==1) return false;
    for(int i=2;i<=sqrt(x);i++){
        if(x%i==0) return false;
    }
    return true;
}

int n;

int main(){
    cin>>n;
    bool flag=false;
    for(int i=2;i<=n;i++){
        if(prime(i)&&prime(i+2)){
            cout<<i<<" "<<i+2<<endl;
            flag=true;
        }
    }
    return 0;
}

那位蒟蒻可以帮忙看看啊?谢谢

2023/1/29 14:28
加载中...