Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- long int N, i, j, lt, rt;
- ifstream in("input.txt");
- ofstream out("output.txt");
- inline bool primary(long int n) { return (n%2!=0 && n%3!=0); }
- bool resolve() {
- for(i = 1; i <= N/2; i++) {
- for(j = 1; j <= N/2 && i*j <= N; j++) {
- if(primary(i) && primary(j)) {
- if(i * j == N) {
- lt = i, rt = j;
- return true;
- }
- }
- }
- }
- return false;
- }
- int main() {
- in >> N;
- if(!resolve())
- out << -1;
- else
- out << lt << ' ' << rt << endl;
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment