#include<bits/stdc++.h>
using namespace std;
long long ar[1000005];
main()
{
long long n;
while(scanf("%lld",&n)!=EOF)
{
long long diff,fst,scnd,flag=0,i,j,ans=0,a;
for(i=0; i<n; i++)
{
scanf("%lld",&ar[i]);
}
scanf("%lld",&a);
sort(ar,ar+n);
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if((ar[j]+ar[i])==a)
{
diff=ar[j]-ar[i];
if(flag==0||diff<ans)
{
ans=diff;
fst=ar[i];
scnd=ar[j];
flag=1;
}
}
}
}
printf("Peter should buy books whose prices are %lld and %lld.\n\n",fst,scnd);
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন