結果

問題 No.420 mod2漸化式
ユーザー brthyyjpbrthyyjp
提出日時 2021-03-14 01:38:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 152,544 KB
最終ジャッジ日時 2023-08-05 17:41:31
合計ジャッジ時間 9,362 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
152,328 KB
testcase_01 AC 213 ms
152,504 KB
testcase_02 AC 214 ms
152,300 KB
testcase_03 AC 213 ms
151,992 KB
testcase_04 AC 217 ms
152,228 KB
testcase_05 AC 212 ms
152,220 KB
testcase_06 WA -
testcase_07 AC 217 ms
152,264 KB
testcase_08 AC 214 ms
152,316 KB
testcase_09 AC 214 ms
152,132 KB
testcase_10 AC 215 ms
152,136 KB
testcase_11 AC 213 ms
152,268 KB
testcase_12 AC 212 ms
152,308 KB
testcase_13 AC 219 ms
152,324 KB
testcase_14 AC 211 ms
152,300 KB
testcase_15 AC 211 ms
152,128 KB
testcase_16 AC 215 ms
152,384 KB
testcase_17 AC 213 ms
152,304 KB
testcase_18 AC 211 ms
152,332 KB
testcase_19 AC 213 ms
152,268 KB
testcase_20 AC 215 ms
152,300 KB
testcase_21 AC 214 ms
152,152 KB
testcase_22 AC 215 ms
152,292 KB
testcase_23 AC 214 ms
152,288 KB
testcase_24 AC 215 ms
152,544 KB
testcase_25 AC 218 ms
152,276 KB
testcase_26 AC 252 ms
152,240 KB
testcase_27 AC 218 ms
152,144 KB
testcase_28 AC 214 ms
152,264 KB
testcase_29 AC 221 ms
152,292 KB
testcase_30 AC 217 ms
152,404 KB
testcase_31 AC 212 ms
152,324 KB
testcase_32 AC 213 ms
152,480 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

x = int(input())
if x > 31:
    print(0)
    exit()

if x == 0:
    print(1)
    exit()

N = 10**3
C = [[0]*(N+1) for i in range(N+1)] #C[n][k] > nCk

for i in range(N+1):
    for j in range(i+1):
        if j == 0 or j == i:
            C[i][j] = 1
        else:
            C[i][j] = C[i-1][j-1]+C[i-1][j]

def cmb(n, k):
    return C[n][k]

table = [0]*33
table[0] = 1
for i in range(1, 33):
    table[i] = table[i-1]*2

c = cmb(31, x)
s = 0
for i in range(31):
    s += table[i]*cmb(30, x-1)
print(c, s)
0