結果

問題 No.2176 LRM Question 1
ユーザー sepa38
提出日時 2023-01-07 09:53:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2024-12-14 09:13:39
合計ジャッジ時間 2,139 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

l, r, m = map(int, input().split())
if l > m:
  print(0)
  exit()
fac = 1
now = 1
for i in range(l):
  fac *= i + 1
  fac %= m
  now *= fac
  now %= m
ans = 0
for i in range(l, r+1):
  if now == 0:
    break
  ans += now
  fac *= i + 1
  fac %= m
  now *= fac
  now %= m
print(ans % m)
0