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;
int check(long long a){
long long x=sqrt(a);
for(int i=2;i<=x;i++){
if(a%i==0){
return 0;
}
}
return 1;
}
int main(){
long long a,b;
cin>>a>>b;
if(a==2){
if(check(b-2)){
cout<<'3'<<"\n"<<a<<" "<<b-2<<" "<<b;
}else if(check(b+2)){
cout<<'3'<<"\n"<<a<<" "<<b+2<<" "<<b;
}
}else if(b==2){
if(check(a-2)){
cout<<'3'<<"\n"<<a<<" "<<a-2<<" "<<b;
}else if(check(a+2)){
cout<<'3'<<"\n"<<a<<" "<<a+2<<" "<<b;
}
}else if(abs(a-b)==2){
cout<<'2'<<"\n"<<a<<" "<<b;
}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... |