結果

問題 No.250 atetubouのzetubou
ユーザー yomo3yomo3
提出日時 2020-03-21 02:06:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 832 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 87,416 KB
実行使用メモリ 81,896 KB
最終ジャッジ日時 2023-08-22 07:50:27
合計ジャッジ時間 13,089 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 556 ms
80,552 KB
testcase_01 AC 219 ms
78,436 KB
testcase_02 AC 804 ms
80,400 KB
testcase_03 AC 832 ms
81,636 KB
testcase_04 AC 745 ms
81,660 KB
testcase_05 AC 758 ms
81,392 KB
testcase_06 AC 634 ms
80,780 KB
testcase_07 AC 406 ms
79,872 KB
testcase_08 AC 713 ms
81,492 KB
testcase_09 AC 614 ms
80,852 KB
testcase_10 AC 789 ms
81,896 KB
testcase_11 AC 535 ms
80,704 KB
testcase_12 AC 704 ms
79,060 KB
testcase_13 AC 494 ms
81,756 KB
testcase_14 AC 120 ms
77,612 KB
testcase_15 AC 248 ms
79,740 KB
testcase_16 AC 248 ms
79,748 KB
testcase_17 AC 261 ms
80,056 KB
testcase_18 AC 254 ms
79,564 KB
testcase_19 AC 255 ms
79,756 KB
testcase_20 AC 103 ms
72,176 KB
testcase_21 AC 104 ms
72,364 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