g471: 12959: Strategy Game
Tags :
Accepted rate : 39人/42人 ( 93% ) [非即時]
評分方式:
Tolerant

最近更新 : 2021-11-23 18:42

Content

A strategy game with $J$ players is played around a table. Players are identified by numbers from 1 to $J$ and will play a total of $R$ rounds. At each round each player will play once, in the order of their identifiers; that is, player 1 will play first, player 2 will play second, and so on. Once player $J$ plays, the round is complete, and a next round starts. A player earns a certain amount of Victory Points every time she or he plays. After all rounds are finished the total points of each player is computed as the sum of Victory Points the player earned on each round. The winner is the player with the maximum number of points; in case of a tie the winner is the player who earned the maximum number of points and played last. Given the number of players, the number of rounds and a list describing the Victory Points in the order they were obtained, you must determine which player is the winner.

Input

The input contains several test cases. In each test case, the first line contains two integers $J$ and $R$, respectively the number of players and the number of turns (1 ≤ $J$, $R$ ≤ 500). The second line contains $J$ ∗ $R$ integers, representing the Victory Points earned by each player in each turn, in the order they happened. The Victory Points obtained in each turn will be always integer numbers between 0 and 100, inclusive. If both $J$ and $R$ are of values zero, then the input ends.

Output

For each test case in the input, your program must produce one single line, containing the integer representing the winner.

Sample Input #1
3 3
1 1 1 1 2 2 2 3 3
2 3
0 0 1 0 2 0
0 0
Sample Output #1
3
1
測資資訊:
記憶體限制: 512 MB
不公開 測資點#0 (33%): 1.0s , <1M
不公開 測資點#1 (33%): 1.0s , <1M
不公開 測資點#2 (1%): 0.1s , <1K
不公開 測資點#3 (33%): 1.0s , <10M
Hint :

測資為隨機產生,若有錯誤歡迎提出

Tags:
出處:
UVA12959CPE第一題 [管理者:
fire5386 (fffelix)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」