結果
| 問題 | No.79 過小評価ダメ・ゼッタイ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-04 11:20:23 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 30 ms / 5,000 ms |
| + 885µs | |
| コード長 | 681 bytes |
| 記録 | |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 12,896 KB |
| 最終ジャッジ日時 | 2026-09-29 16:47:40 |
| 合計ジャッジ時間 | 2,258 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
from collections import Counter
def calculate_mode(data):
c = Counter(data)
#すべての要素とその出現回数を取り出します
freq_scores = c.most_common()
#c.most_common内の最も多い要素[0]の最大出現回数[1]を[0][1]で指定
max_count = freq_scores[0][1]
modes = []
#出現回数と最大出現回数が等しいかを確認します。
for num in freq_scores:
if num[1] == max_count:
modes.append(num[0])
return(modes)
n = int(input())
l = list(map(int, input().split()))
if __name__ == '__main__':
data = l
modes = calculate_mode(data)
modes.sort(reverse = True)
print(modes[0])