結果

問題 No.2176 LRM Question 1
ユーザー ああいい
提出日時 2023-01-09 10:54:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 59,696 KB
最終ジャッジ日時 2024-12-17 14:47:13
合計ジャッジ時間 2,377 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def calc(N):
    N = min(N,M)
    ans = 0
    now = 1
    tmp = 1
    for i in range(1,N + 1):
        tmp *= i
        tmp %= M
        now *= tmp
        now %= M
        ans += now
        ans %= M
    return ans
print((calc(R) - calc(L - 1))%M)
0