# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1084424 | laure | Lutrija (COCI19_lutrija) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
vector<bool>vis(1005,0);
set<int>p;
for(int i=2;i<=1000;i++)
{
if(!vis[i])
{
p.insert(i);
for(int j=i*i;j<=1000;j+=i)vis[j]=1;
}
}
int a,b;
cin>>a>>b;
if(p.count(abs(a-b))){cout<<a<<" "<<b<<'\n';return 0;}
int ans=-1;
for(auto u:p)
{
if(p.count(abs(a-u))&&p.count(abs(b-u)))
{
ans=u;
break;
}
}
else cout<<a<<" "<<ans<<" "<<b<<'\n';
}