Submission #936644

#TimeUsernameProblemLanguageResultExecution timeMemory
936644WarinchaiLutrija (COCI19_lutrija)C++14
70 / 70
219 ms432 KiB
#include<bits/stdc++.h> using namespace std; bool check(long long x){ if(x<2)return 0; long long s=sqrt(x); for(long long i=2;i<=s;i++){ if(x%i==0)return 0; } return 1; } int main(){ long long a,b;cin>>a>>b; if(check(abs(b-a)))cout<<2<<"\n"<<a<<" "<<b; else if(a==2&&check(b+2))cout<<3<<"\n"<<a<<" "<<b+2<<" "<<b; else if(b==2&&check(a+2))cout<<3<<"\n"<<a<<" "<<a+2<<" "<<b; else if(check(a+2)&&check(b-2))cout<<4<<"\n"<<a<<" "<<a+2<<" "<<2<<" "<<b; else if(check(a-2)&&check(b+2))cout<<4<<"\n"<<a<<" "<<2<<" "<<b+2<<" "<<b; else if(check(a-2)&&check(b-2))cout<<3<<"\n"<<a<<" "<<2<<" "<<b; else if(check(a+2)&&check(b+2))cout<<5<<"\n"<<a<<" "<<a+2<<" "<<2<<" "<<b+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...