-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprime.cpp
More file actions
44 lines (36 loc) · 696 Bytes
/
Copy pathprime.cpp
File metadata and controls
44 lines (36 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
const int N = 2e5 + 11;
bool isPrime(int n){
int root = sqrt(n);
for (int i = 2; i <= root; i++)
if(n%i==0) return false;
return true;
}
void solve() {
int n;
cin>>n;
int l = n>>1;
int r = n>>1;
if(n%2) r++;
while((isPrime(l) || isPrime(r))) {
l--;
r++;
}
cout<<l<< " "<<r<<endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
freopen("input.txt", "r", stdin);
int no_of_test_cases = 1;
// cin >> no_of_test_cases;
while (no_of_test_cases--) execute();
return 0;
}