結果

問題 No.250 atetubouのzetubou
ユーザー yomo3yomo3
提出日時 2020-03-20 20:33:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,576 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 8,972 KB
最終ジャッジ日時 2023-08-21 08:56:35
合計ジャッジ時間 38,765 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,041 ms
8,948 KB
testcase_01 AC 360 ms
8,776 KB
testcase_02 AC 3,161 ms
8,952 KB
testcase_03 AC 3,576 ms
8,948 KB
testcase_04 AC 3,127 ms
8,776 KB
testcase_05 AC 3,214 ms
8,972 KB
testcase_06 AC 2,483 ms
8,884 KB
testcase_07 AC 1,199 ms
8,776 KB
testcase_08 AC 2,944 ms
8,920 KB
testcase_09 AC 2,256 ms
8,936 KB
testcase_10 AC 3,193 ms
8,864 KB
testcase_11 AC 1,947 ms
8,768 KB
testcase_12 AC 2,899 ms
8,812 KB
testcase_13 AC 1,596 ms
8,784 KB
testcase_14 AC 35 ms
8,688 KB
testcase_15 AC 123 ms
8,752 KB
testcase_16 AC 127 ms
8,592 KB
testcase_17 AC 124 ms
8,620 KB
testcase_18 AC 124 ms
8,600 KB
testcase_19 AC 125 ms
8,692 KB
testcase_20 AC 20 ms
8,724 KB
testcase_21 AC 20 ms
8,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce

def comb(n, r):
    if n < 0 or r < 0 or r > n:
        return 0
    r = min(r, n - r)
    if r == 0: return 1

    numer = [n - r + i + 1 for i in range(r)]
    denom = [i + 1 for i in range(r)]

    for i in range(1, r):
        divisor = denom[i]
        if divisor > 1:
            offset = (n - r) % (i + 1)
            for j in range(i, r, i+1):
                numer[j - offset] //= divisor
                denom[j] //= divisor

    return reduce(lambda x, y: x*y if y > 1 else x, numer)


for _ in range(int(input())):
    d, x, t = map(int, input().split())
    n = comb(x+d-1, d-1)
    print('ZETUBOU' if n > t else 'AC')
0