結果

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

ソースコード

diff #

from math import comb


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

    if x > 31:
        print(0, 0)
        return

    if x == 0:
        print(1, 0)
        return

    patterns = comb(31, x)
    if x == 1 or x == 31:
        sum_ = 2**31 - 1
    else:
        sum_ = (2**31 - 1) * comb(30, x - 1)

    print(patterns, sum_)


if __name__ == "__main__":
    main()
0