結果

問題 No.2176 LRM Question 1
ユーザー mkawa2mkawa2
提出日時 2023-01-06 21:44:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 969 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 152,312 KB
最終ジャッジ日時 2023-08-20 14:48:28
合計ジャッジ時間 3,526 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
70,980 KB
testcase_01 AC 59 ms
71,248 KB
testcase_02 AC 120 ms
152,312 KB
testcase_03 AC 59 ms
71,236 KB
testcase_04 AC 122 ms
152,060 KB
testcase_05 AC 68 ms
78,368 KB
testcase_06 AC 66 ms
76,264 KB
testcase_07 AC 67 ms
77,504 KB
testcase_08 AC 124 ms
152,276 KB
testcase_09 AC 116 ms
144,112 KB
testcase_10 AC 111 ms
136,384 KB
testcase_11 AC 59 ms
71,288 KB
testcase_12 AC 59 ms
71,288 KB
testcase_13 AC 117 ms
152,092 KB
testcase_14 AC 120 ms
151,860 KB
testcase_15 AC 124 ms
136,424 KB
testcase_16 AC 105 ms
123,400 KB
testcase_17 AC 64 ms
76,484 KB
testcase_18 AC 112 ms
143,828 KB
testcase_19 AC 100 ms
118,400 KB
testcase_20 AC 77 ms
89,844 KB
testcase_21 AC 88 ms
105,056 KB
testcase_22 AC 65 ms
77,744 KB
testcase_23 AC 86 ms
101,568 KB
testcase_24 AC 90 ms
105,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

l, r, m = LI()

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

l = min(l-1, m-1)
r = min(r, m-1)
ans = fac[r]-fac[l]
print(ans%m)
0