Submission #716604

# Submission time Handle Problem Language Result Execution time Memory
716604 2023-03-30T14:18:52 Z Warinchai Lutrija (COCI19_lutrija) C++14
7 / 70
1 ms 212 KB
#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 time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -