HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50470 - Close Pairs - Revised

Guest
• Review clarifications (1)

Volume problems

• 50758 - National Elections - Revisited
• 50687 - Pascal Triangle - 2
• 50756 - Average of the Nth Student
• 50457 - The Number of Winners
• 50752 - Student Groups
• 50451 - Processing Cost
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50470 - Close Pairs - Revised
• 50998 - CEN112 Homework, quiz av...
• 50804 - Marathon
• 50835 - Club Presidency
• 50526 - Gold Market
• 50458 - Weekly Report
• 50872 - Top M Grades
• 50868 - Sort Frequencies
• 50405 - Accounts Receivable

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