Submission #739977

#TimeUsernameProblemLanguageResultExecution timeMemory
739977ToxtaqLutrija (COCI19_lutrija)C++17
14 / 70
1 ms304 KiB
#include<bits/stdc++.h> using namespace std; bool IsPrime(long long n){ if(n == 1)return 0; if(n == 2)return 1; if(n % 2 == 0)return 0; for(long long i = 3;i * i <= n;i += 2){ if(n % i == 0)return 0; } return 1; } int main() { long long a, b; cin >> a >> b; if(IsPrime(abs(a - b))){ cout << "2 \n" << a << " " << b; return 0; } else{ for(int i = 2;i <= 1000;++i){ if(IsPrime(i) && IsPrime(abs(a - i)) && IsPrime(abs(b - i))){ cout << "3 \n" << a << " " << i << " " << b; return 0; } } } 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...