HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN_114 Midterm A > problem:


12. 50470 - Close Pairs - Revised

CEN_114 Midterm A

Start: May.14.2020 at 12:00:01 AM
Finish: May.31.2020 at 11:55:59 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1. 50467 - Random Numbers
• 10. 51093 - rgb2gray
• 11. 50410 - Zero Padding
• 12. 50470 - Close Pairs - Revised
• 13. 50735 - Top M Products
• 14. 51094 - Passing the course
• 15. 50804 - Marathon
• 3. 50390 - Total Salary Paid
• 4. 50528 - Rock-Scissors-Paper
• 5. 51087 - Are they the same?
• 6. 51092 - Even and Odd
• 7. 50449 - The biggest result

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Close Pair

Question: You will be given n integer numbers. Print the two numbers whose difference is the closest. Show any two, if there are many numbers giving the same minimum difference.

Input specification
You will be first given a number (n) which shows the number of numbers where 0 ≤ n ≤ 1000. Then in following n lines you will be given n numbers where each number is between -10000 and 10000.

Output specification
Print the two numbers whose difference is the closest.

 Sample Input I     Sample Input II   
 3
 8 5 6
 5
 6 -5 6 8 3
 Sample Output I     Sample Output II   
 5 6
 6 6


Для отправки решений необходимо выполнить вход.

www.contester.ru