問題一覧 > 通常問題

No.706 Survey of Many-Eyed Creatures

レベル : / AI推定難易度 : 124 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 354
作問者 : gotutiyan / テスター : ciel
お気に入りにしたユーザー ProblemId : 1927 / 自分の提出
問題文最終更新日: 2026-06-26 08:58:16
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 194 (順位表) の他の問題:

Problem Statement

On a certain planet, there live creatures with various numbers of eyes. A scholar studying these creatures, in order to investigate the distribution of the number of eyes, has decided for now to represent each creature using as many "^" as it has eyes.
For example, a creature with 2 eyes is represented as "(^^)", and one with 5 eyes as "(^^^^^)".
Output the number of eyes observed most frequently among the N creatures (the mode). (This is not the maximum value.)
If there are multiple possible answers, output the larger one.

Input

N
S1
S2
....
Sn

The number N of creatures examined is given, followed by N lines containing the figures S1,S2....Sn such as (^^).
1<=N<=1000
2<=|S|<=1000

Output

Output the most frequently observed number of eyes. Print a newline at the end.

Sample

Sample 1
Input
5
(^^)
(^^^)
(^^)
(^^^)
(^^)
Output
2

There were 3 creatures with 2 eyes and 2 creatures with 3 eyes, so 2 eyes was observed most frequently.

Sample 2
Input
1
(^^^^^)
Output
5

Sample 3
Input
10
(^^)
(^)
(^^^^^^)
(^^^^)
(^^^^)
(^^^^^^^^^^)
(^^^)
(^^^^^^^)
(^^^^^^^^^^^)
(^^^^^^)
Output
6

There were 2 creatures each with 4 eyes and with 6 eyes, and 1 creature each for every other number of eyes. The larger number of eyes is the answer, so the answer is 6.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。