結果

問題 No.420 mod2漸化式
ユーザー nanae
提出日時 2017-02-10 09:11:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 1,000 ms
コード長 568 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-26 14:22:53
合計ジャッジ時間 2,731 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import factorial

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def binom(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def solve():
    x = int(input())

    if x >= 32:
        print(0,0)
        return
    elif x == 0:
        print(1,0)
        return

    sum2 = 2**31 - 1

    comb = binom(31, x)
    tot = sum2 * binom(30, x-1)

    print(comb, tot)

if __name__ == '__main__':
    solve()
0