結果

問題 No.112 ややこしい鶴亀算
ユーザー knk_kei
提出日時 2021-02-03 02:39:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 397 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-30 00:10:36
合計ジャッジ時間 1,621 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
# いろんな解き方があるが、1種類ならその値+2//n = 2になるかの判定
if len(set(a)) == 1:
    if (a[0] + 2) // n == 2:
        print(n, 0)
    else:
        print(0, n)
else:
    ma = max(a)
    c, t = 0, 0
    for i in range(n):
        if a[i] != ma:
            t += 1
        else:
            c += 1
    print(c, t)

0