結果

問題 No.3045 怪文書
ユーザー はむ吉🐹はむ吉🐹
提出日時 2019-04-01 22:48:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 8,788 KB
最終ジャッジ日時 2023-08-18 01:56:23
合計ジャッジ時間 1,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,596 KB
testcase_01 AC 20 ms
8,600 KB
testcase_02 AC 22 ms
8,624 KB
testcase_03 AC 21 ms
8,664 KB
testcase_04 AC 21 ms
8,624 KB
testcase_05 AC 20 ms
8,764 KB
testcase_06 AC 20 ms
8,676 KB
testcase_07 AC 30 ms
8,728 KB
testcase_08 AC 21 ms
8,600 KB
testcase_09 AC 20 ms
8,704 KB
testcase_10 AC 21 ms
8,776 KB
testcase_11 AC 20 ms
8,788 KB
testcase_12 AC 20 ms
8,604 KB
testcase_13 AC 20 ms
8,596 KB
testcase_14 AC 21 ms
8,784 KB
testcase_15 AC 19 ms
8,628 KB
testcase_16 AC 20 ms
8,600 KB
testcase_17 AC 20 ms
8,684 KB
testcase_18 AC 20 ms
8,748 KB
testcase_19 AC 19 ms
8,600 KB
testcase_20 AC 20 ms
8,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import functools


def product_mod(xs, m):
    return functools.reduce(lambda x, y: x * y % m, xs, 1) % m


def factorial_mod(n, m):
    return product_mod(range(1, n + 1), m)


def main():
    n, m = (int(z) for z in input().split())
    if n >= m:
        print(0)
    else:
        print(factorial_mod(n, m))


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