Submission #716604

#TimeUsernameProblemLanguageResultExecution timeMemory
716604WarinchaiLutrija (COCI19_lutrija)C++14
7 / 70
1 ms212 KiB
#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 if(check(a-2)&&check(b-2)){ cout<<'3'<<"\n"<<a<<" "<<'2'<<" "<<b; }else{ cout<<"-1"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...