結果

問題 No.2176 LRM Question 1
ユーザー coder_So_heycoder_So_hey
提出日時 2023-01-13 23:18:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 75,884 KB
最終ジャッジ日時 2023-08-26 05:00:16
合計ジャッジ時間 3,546 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,284 KB
testcase_01 AC 62 ms
71,168 KB
testcase_02 AC 73 ms
75,864 KB
testcase_03 AC 64 ms
71,316 KB
testcase_04 AC 62 ms
71,420 KB
testcase_05 AC 68 ms
75,788 KB
testcase_06 AC 63 ms
71,416 KB
testcase_07 AC 67 ms
75,652 KB
testcase_08 AC 64 ms
71,192 KB
testcase_09 AC 66 ms
75,776 KB
testcase_10 AC 73 ms
75,780 KB
testcase_11 AC 63 ms
71,184 KB
testcase_12 AC 74 ms
71,220 KB
testcase_13 AC 64 ms
71,224 KB
testcase_14 AC 76 ms
75,672 KB
testcase_15 AC 71 ms
75,884 KB
testcase_16 AC 69 ms
75,792 KB
testcase_17 AC 68 ms
75,760 KB
testcase_18 AC 62 ms
71,196 KB
testcase_19 AC 62 ms
71,228 KB
testcase_20 AC 63 ms
71,120 KB
testcase_21 AC 68 ms
75,880 KB
testcase_22 AC 67 ms
75,664 KB
testcase_23 AC 70 ms
75,784 KB
testcase_24 AC 64 ms
71,308 KB
権限があれば一括ダウンロードができます

ソースコード

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