30分求助!!!
查看原帖
30分求助!!!
677139
Dreams_Knight楼主2023/2/2 20:42
#include<bits/stdc++.h>
using namespace std;
bool is_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 main(){
	int n;
	cin >> n;
    for(int i = 2;i < n - 1;i++){
        if(is_prime(i) and is_prime(i) and is_prime(n - i - i) and i + i + (n - i - i) == n){
                cout << i << " " << i << " " << n - i - i;
                return 0; 
        }
    }
} 
2023/2/2 20:42
加载中...