이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back;
using namespace std;
bool prost(ll n)
{
if(n==1) return false;
for(ll i=2;i*i<=n;i++)
{
if(n%i==0) return false;
}
return true;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll a,b;
cin>>a>>b;
if(a==2)
{
if(prost(b-2))
{
cout<<2<<endl;
cout<<2<<" "<<b<<endl;
}
else if(prost(b+2))
{
cout<<3<<endl;
cout<<2<<" "<<b+2<<" "<<b<<endl;
}
else
{
cout<<-1<<endl;
}
}
else if(a==3)
{
if(b==5)
{
cout<<2<<endl;
cout<<3<<" "<<5<<endl;
}
else if(b==7)
{
cout<<3<<endl;
cout<<3<<" "<<5<<" "<<7<<endl;
}
else
{
cout<<-1<<endl;
}
}
else
{
if(abs(a-b)==2)
{
cout<<2<<endl;
cout<<a<<" "<<b<<endl;
}
else
{
cout<<-1<<endl;
}
}
return 0;
}
# | 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... |