This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
long long x, y;
bool check(int x)
{
for(int i = 2; i * i <= x; ++i) if(x % i == 0) return 0;
return 1;
}
int main()
{
cin >> x >> y;
if(check(abs(x - y))) cout << "2\n" << x << " " << y;
else if(x == 2 || y == 2)
{
if(check(max(x, y) + 2)) cout << "3\n" << x << " " << max(x, y) + 2 << " " << y;
else if(check(max(x, y) - 2)) cout << "3\n" << x << " " << max(x, y) - 2 << " " << y;
else cout << -1;
}
else
{
if(check(x - 2) && check(y - 2)) cout << "3\n" << x << " 2 " << y;
else cout << -1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |