結果

問題 No.2176 LRM Question 1
ユーザー coder_So_heycoder_So_hey
提出日時 2023-01-13 23:18:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 58,368 KB
最終ジャッジ日時 2024-12-24 19:25:27
合計ジャッジ時間 2,610 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

R = min(R + 1, M)
a, b = 1, 1

for i in range(2, L):
    a *= i
    a %= M
    b *= a
    b %= M

ans = 0

for i in range(L, R):
    a *= i
    a %= M
    b *= a
    b %= M
    ans += b
    ans %= M

print(ans)
0