結果

問題 No.250 atetubouのzetubou
ユーザー nebukuro09nebukuro09
提出日時 2016-10-31 11:35:35
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 76,316 KB
実行使用メモリ 80,572 KB
最終ジャッジ日時 2024-05-03 20:03:10
合計ジャッジ時間 11,417 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 95 ms
78,080 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 76 ms
75,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ncr(n, r):
    if n - r < r:
        r = n-r
    if r == 0:
        return 1
    if r == 1:
        return n

    numerator = [0 for i in xrange(r)]
    denominator = [0 for i in xrange(r)]

    for k in xrange(r):
        numerator[k] = n - r + k + 1
        denominator[k] = k + 1
    
    for p in xrange(2, r+1):
        pivot = denominator[p-1]
        if pivot > 1:
            offset = (n-r) % p
            for k in range(p-1, r, p):
                numerator[k-offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in xrange(r):
        if numerator[k] > 1:
            result = (result*numerator[k])

    return result

for i in xrange(input()):
    d, x, t = map(int, raw_input().split())
    print 'AC' if ncr(x+d-1, d) <= t else 'ZETUBOU'
0