Pagini recente » Cod sursa (job #1685982) | Cod sursa (job #2866075) | Cod sursa (job #1640042) | Cod sursa (job #1170890) | Cod sursa (job #585787)
Cod sursa(job #585787)
#include <stdio.h>
#include <bitset>
using namespace std;
#define N_MAX 10000010
bitset <N_MAX> b;
int n;
void found(int x) {
printf("%d %d\n", (n/x)*(x-1), n/x);
}
void ciur() {
for(int i = 4; i <= n; i+= 2) b[i] = 1;
for(int i = 3; i <= n; i += 2)
if(!b[i]) {
if(n%i==0) {
found(i);
return;
}
for(int j = i; (long long) j*i <= n; ++j)
b[i*j] = 1;
}
}
int main() {
freopen("nummst.in", "r", stdin);
freopen("nummst.out" ,"w", stdout);
scanf("%d", &n);
if(n%2 == 0) {
found(2);
return 0;
}
ciur();
return 0;
}