Why 30pts?
查看原帖
Why 30pts?
1049033
luogu_00楼主2024/12/8 11:07
#include<bits/stdc++.h>
using namespace std;
bool isprime(int x){
    if(x<2){
        return false;
    }
    for(int i=2;i*i<=x;i++){
        if(x%i==0){
            return false;
        }
    }
    return true;
}
int main(){
    int S;
    cin>>S;
    if(isprime(S)){
        cout<<S;
        return 0;
    }
    int l=S/2;
    int r=S-l;
    while(true){
        if(isprime(l)&&isprime(r)){
            cout<<l*r;
            return 0;
        }
        l++;
        r++;
    }
    return 0;
}
2024/12/8 11:07
加载中...