結果

問題 No.2176 LRM Question 1
ユーザー ああいいああいい
提出日時 2023-01-09 10:54:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 75,772 KB
最終ジャッジ日時 2023-08-22 15:23:37
合計ジャッジ時間 4,389 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,116 KB
testcase_01 AC 69 ms
71,396 KB
testcase_02 AC 80 ms
75,536 KB
testcase_03 AC 69 ms
71,428 KB
testcase_04 AC 74 ms
71,280 KB
testcase_05 AC 72 ms
75,596 KB
testcase_06 AC 72 ms
75,600 KB
testcase_07 AC 72 ms
75,432 KB
testcase_08 AC 72 ms
75,612 KB
testcase_09 AC 73 ms
75,600 KB
testcase_10 AC 79 ms
75,600 KB
testcase_11 AC 70 ms
71,224 KB
testcase_12 AC 71 ms
71,396 KB
testcase_13 AC 87 ms
75,528 KB
testcase_14 AC 80 ms
75,388 KB
testcase_15 AC 78 ms
75,584 KB
testcase_16 AC 77 ms
75,372 KB
testcase_17 AC 73 ms
75,556 KB
testcase_18 AC 85 ms
75,772 KB
testcase_19 AC 80 ms
75,568 KB
testcase_20 AC 76 ms
75,572 KB
testcase_21 AC 75 ms
75,636 KB
testcase_22 AC 73 ms
75,548 KB
testcase_23 AC 76 ms
75,600 KB
testcase_24 AC 79 ms
75,368 KB
権限があれば一括ダウンロードができます

ソースコード

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