回分類題庫
d182: CP Lab Exercise: Most Appear
出處:

Difficulity : N/A
Accepted : 75 Times | Submit :295 Times | Clicks : 1740
Accepted : 62 Users | Submit : 63 Users | Accepted rate : 98%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2010-11-03 16:04

Content :

Li has lots of easter eggs in the baskets, each egg has a number on it, from 0-49.
Your task is to count out which kind of egg occurs most in each basket and print out the number of the egg.

Notice:
You have to use 1D array and write a function to pass the exercise.
int biggest( int array[]);
If two kinds of ball occur same times, then you should print out the smallest one.
 

Input :

The first line is a positive number N: the number of the baskets.
The following lines are the numbers on the ball, -1 indicates the end of the basket.
Your job is to compute which kind of ball occurs most.
You can assume the inputs are valid.

Output :

For each basket of input, you have to output a line of the result.

Sample Input :

2
2 
3 
2
-1
1
2
2
3
3
-1

Sample Output :

2
2

Hint :


  

Author :


  Solve it!   Status Forum (2)

C++
C
JAVA
76756. alun0922 (6 ms , 356KB)
64569. s33029005 (6 ms , 370KB)
58688. amy1 (8 ms , 362KB)
57994. CC501 (8 ms , 238KB)
38976. cp100703020 (2 ms , 232KB)
30716. nothinglo (2 ms , 224KB)
30189. chengpoyun (2 ms , 218KB)
26275. cp99703002 (2 ms , 224KB)
25930. cp99703026 (2 ms , 230KB)
50777. nwgs524513cja (106 ms , 164KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡