結果

問題 No.420 mod2漸化式
ユーザー roaris
提出日時 2019-07-31 19:50:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 287 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-05 06:55:02
合計ジャッジ時間 1,797 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

def C(n, r):
    return fact[n] // fact[r] // fact[n-r]

x = int(input())

if x > 31:
    print(0, 0)
    exit()
    
fact = [1]

for i in range(1, 32):
    fact.append(fact[-1] * i)

ans1 = C(31, x)

if x == 0:
    ans2 = 0
else:
    ans2 = (2 ** 31 - 1) * C(30, x-1)

print(ans1, ans2)
0