結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー 2329 N2329 N
提出日時 2020-09-04 11:20:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 681 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 10,512 KB
最終ジャッジ日時 2023-08-16 15:31:33
合計ジャッジ時間 2,224 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,464 KB
testcase_01 AC 40 ms
10,512 KB
testcase_02 AC 18 ms
8,584 KB
testcase_03 AC 18 ms
8,592 KB
testcase_04 AC 18 ms
8,616 KB
testcase_05 AC 41 ms
10,372 KB
testcase_06 AC 17 ms
8,532 KB
testcase_07 AC 17 ms
8,556 KB
testcase_08 AC 18 ms
8,492 KB
testcase_09 AC 18 ms
8,488 KB
testcase_10 AC 18 ms
8,484 KB
testcase_11 AC 18 ms
8,480 KB
testcase_12 AC 18 ms
8,556 KB
testcase_13 AC 19 ms
8,536 KB
testcase_14 AC 31 ms
9,352 KB
testcase_15 AC 23 ms
9,148 KB
testcase_16 AC 35 ms
9,860 KB
testcase_17 AC 23 ms
8,928 KB
testcase_18 AC 35 ms
9,992 KB
testcase_19 AC 30 ms
9,320 KB
testcase_20 AC 41 ms
10,272 KB
testcase_21 AC 18 ms
8,656 KB
testcase_22 AC 26 ms
9,024 KB
testcase_23 AC 39 ms
10,092 KB
testcase_24 AC 40 ms
10,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0