結果

問題 No.2176 LRM Question 1
ユーザー minimumminimum
提出日時 2023-01-06 21:30:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 836 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 152,008 KB
最終ジャッジ日時 2023-08-20 14:32:22
合計ジャッジ時間 4,274 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
71,212 KB
testcase_01 AC 86 ms
71,216 KB
testcase_02 AC 166 ms
152,000 KB
testcase_03 AC 82 ms
71,068 KB
testcase_04 AC 144 ms
151,648 KB
testcase_05 AC 92 ms
77,876 KB
testcase_06 AC 84 ms
75,952 KB
testcase_07 AC 85 ms
77,480 KB
testcase_08 AC 142 ms
151,952 KB
testcase_09 AC 138 ms
143,988 KB
testcase_10 AC 138 ms
136,376 KB
testcase_11 AC 81 ms
71,208 KB
testcase_12 AC 80 ms
71,324 KB
testcase_13 AC 80 ms
70,984 KB
testcase_14 AC 152 ms
152,008 KB
testcase_15 AC 141 ms
136,324 KB
testcase_16 AC 129 ms
123,288 KB
testcase_17 AC 88 ms
76,196 KB
testcase_18 AC 79 ms
71,044 KB
testcase_19 AC 86 ms
71,352 KB
testcase_20 AC 77 ms
71,264 KB
testcase_21 AC 109 ms
104,792 KB
testcase_22 AC 82 ms
77,332 KB
testcase_23 AC 103 ms
101,420 KB
testcase_24 AC 76 ms
71,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if L >= M:
    print(0)
    exit()

R = min(M - 1, R)

f = [1]
fac = 1
for n in range(1, M):
    fac = (fac * n) % M
    f.append((fac * f[-1]) % M)

ans = 0
for n in range(L, R + 1):
    ans = (ans + f[n]) % M

print(ans)
0