結果

問題 No.2176 LRM Question 1
ユーザー tassei903tassei903
提出日時 2023-01-06 22:37:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 1,202 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 153,056 KB
最終ジャッジ日時 2023-08-20 15:54:32
合計ジャッジ時間 4,930 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,432 KB
testcase_01 AC 79 ms
71,316 KB
testcase_02 AC 210 ms
153,056 KB
testcase_03 AC 77 ms
71,400 KB
testcase_04 AC 147 ms
152,924 KB
testcase_05 AC 88 ms
78,348 KB
testcase_06 AC 83 ms
76,404 KB
testcase_07 AC 89 ms
77,868 KB
testcase_08 AC 148 ms
152,148 KB
testcase_09 AC 147 ms
144,516 KB
testcase_10 AC 144 ms
136,540 KB
testcase_11 AC 78 ms
71,264 KB
testcase_12 AC 79 ms
71,512 KB
testcase_13 AC 154 ms
152,356 KB
testcase_14 AC 163 ms
152,356 KB
testcase_15 AC 147 ms
136,052 KB
testcase_16 AC 133 ms
123,700 KB
testcase_17 AC 87 ms
76,700 KB
testcase_18 AC 145 ms
143,880 KB
testcase_19 AC 127 ms
118,412 KB
testcase_20 AC 99 ms
90,032 KB
testcase_21 AC 118 ms
105,400 KB
testcase_22 AC 88 ms
77,576 KB
testcase_23 AC 113 ms
101,972 KB
testcase_24 AC 114 ms
105,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
l,r,m = na()
r = min(r, m)
l = min(l, r)
ans = 0

f = [1]
for i in range(m):
    f.append(f[-1]*(i+1)%m)

for i in range(m):
    f[i+1] *= f[i]
    f[i+1] %= m

for x in range(l, r+1):
    ans += f[x]
    ans %= m
print(ans)
0