結果
問題 |
No.79 過小評価ダメ・ゼッタイ
|
ユーザー |
|
提出日時 | 2020-09-04 11:20:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 53 ms / 5,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 106 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,660 KB |
最終ジャッジ日時 | 2024-11-25 05:21:35 |
合計ジャッジ時間 | 1,976 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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])