B - Festival Visitors: The Busiest Day
Editorial
/
/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 233 点
問題文
高橋君の店では、 N 日間の祭日に特別セールを行いました。 i 日目の来客数は A_i 人でした。
来客数が最も多かった日は何日目かを求めてください。来客数が最も多い日が複数ある場合は、そのうち最も早い日を答えてください。
制約
- 1 \leq N \leq 100
- 0 \leq A_i \leq 10000
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N A_1 A_2 \ldots A_N
- 1 行目には、祭日の日数 N が与えられる。
- 2 行目には、各日の来客数 A_1, A_2, \ldots, A_N がスペース区切りで与えられる。
出力
来客数が最も多かった日が何日目かを 1 行で出力せよ。複数ある場合は最も早い日を出力せよ。
入力例 1
5 3 8 2 8 5
出力例 1
2
入力例 2
1 0
出力例 2
1
入力例 3
4 1 2 3 4
出力例 3
4
入力例 4
4 2 2 3 4
出力例 4
4
入力例 5
4 1 4 3 4
出力例 5
2
Score : 233 pts
Problem Statement
Takahashi's shop held a special sale during a festival lasting N days. On day i, A_i customers visited the shop.
Find which day had the most visitors. If multiple days had the most visitors, answer the earliest such day.
Constraints
- 1 \leq N \leq 100
- 0 \leq A_i \leq 10000
- All input values are integers.
Input
Input is given from standard input in the following format:
N A_1 A_2 \ldots A_N
- The first line contains the number of festival days N.
- The second line contains the visitor counts A_1, A_2, \ldots, A_N for each day, separated by spaces.
Output
Print, on a single line, which day had the most visitors. If there are multiple such days, print the earliest one.
Sample Input 1
5 3 8 2 8 5
Sample Output 1
2
Sample Input 2
1 0
Sample Output 2
1
Sample Input 3
4 1 2 3 4
Sample Output 3
4
Sample Input 4
4 2 2 3 4
Sample Output 4
4
Sample Input 5
4 1 4 3 4
Sample Output 5
2