結果

問題 No.2176 LRM Question 1
ユーザー 👑 KazunKazun
提出日時 2023-01-06 21:26:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 894 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 91,380 KB
最終ジャッジ日時 2023-08-20 14:27:30
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,220 KB
testcase_01 AC 63 ms
71,324 KB
testcase_02 AC 113 ms
91,212 KB
testcase_03 AC 65 ms
71,332 KB
testcase_04 AC 108 ms
91,380 KB
testcase_05 AC 71 ms
76,384 KB
testcase_06 AC 68 ms
75,528 KB
testcase_07 AC 68 ms
76,176 KB
testcase_08 AC 107 ms
91,156 KB
testcase_09 AC 109 ms
90,932 KB
testcase_10 AC 103 ms
88,836 KB
testcase_11 AC 64 ms
71,492 KB
testcase_12 AC 65 ms
71,308 KB
testcase_13 AC 106 ms
91,180 KB
testcase_14 AC 111 ms
91,172 KB
testcase_15 AC 99 ms
88,120 KB
testcase_16 AC 94 ms
85,832 KB
testcase_17 AC 68 ms
75,820 KB
testcase_18 AC 103 ms
89,716 KB
testcase_19 AC 94 ms
85,208 KB
testcase_20 AC 78 ms
79,092 KB
testcase_21 AC 86 ms
81,868 KB
testcase_22 AC 66 ms
76,164 KB
testcase_23 AC 84 ms
81,068 KB
testcase_24 AC 88 ms
82,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    L,R,M=map(int,input().split())

    if L>M:
        L=M
    if R>M:
        R=M

    fact=[1]*(M+1)
    for i in range(1,M+1):
        fact[i]=i*fact[i-1]%M

    prod=[1]*(M+1)
    for i in range(1,M+1):
        prod[i]=fact[i]*prod[i-1]%M

    X=0
    for i in range(L,R+1):
        X+=prod[i]
    return X%M

#==================================================
print(solve())
0