-->
当前位置:首页 > 题库

PROGRAMMING:The most popular dish

Luz5年前 (2021-05-10)题库361
A cafeteria requires its customers to vote after eating and choose a favorite dish. After the end of business, the most popular dish is the one with the most votes.
Please write a program to help restaurants quickly complete this statistical work.
###Input format:
The first line gives a positive integer n (no more than 1000), which indicates the number of dishes. Each dish is numbered with 1 ~ n.
On the second line, enter a number of positive integers separated by spaces to indicate the number of the favorite dish that the guest throws, and end the input with the keyboard terminator ^ Z or file terminator.
###Output format:
Each line output a most popular dish number and votes. There is a space between the dish number and the number of tickets. If there are the most popular dishes in parallel, output each dish in the order of number from small to large, and each dish occupies one line.
###Input example:
```in
ten
6 8 5 8 9 3 6 6 8 2 1 4 7 2 8 3 8 9 6 3 8 10 6 6
```
###Output example:
```out
6 6
8 6
```







answer:If there is no answer, please comment