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>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
int go (int x)
{
for(int i=2;i*i<=x;i++)
{
if((x%i)==0)return 0;
}
return 1;
}
int main()
{
ll l,r;cin>>l>>r;
if(go(abs(r-l)))
{
cout<<2<<endl<<l<<" "<<r;return 0;
}
if(r-2>1&&go(abs(r-2-l)))
{
cout<<3<<endl<<l<<" "<<r-2<<" "<<r;return 0;
}
if(l-2>1&&go(abs(l-2-r)))
{
cout<<3<<endl<<l<<" "<<l-2<<" "<<r;return 0;
}
if(go(abs(r+2-l)))
{
cout<<3<<endl<<l<<" "<<r+2<<" "<<r;return 0;
}
if(go(abs(l+2-r)))
{
cout<<3<<endl<<l<<" "<<l+2<<" "<<r;return 0;
}
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... |