結果

問題 No.2176 LRM Question 1
ユーザー sepa38sepa38
提出日時 2023-01-07 09:53:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 75,940 KB
最終ジャッジ日時 2023-08-21 01:33:09
合計ジャッジ時間 3,662 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,396 KB
testcase_01 AC 71 ms
71,204 KB
testcase_02 AC 72 ms
71,204 KB
testcase_03 AC 70 ms
71,420 KB
testcase_04 AC 74 ms
71,104 KB
testcase_05 AC 77 ms
75,652 KB
testcase_06 AC 72 ms
71,300 KB
testcase_07 AC 76 ms
75,816 KB
testcase_08 AC 74 ms
71,196 KB
testcase_09 AC 78 ms
75,548 KB
testcase_10 AC 76 ms
75,848 KB
testcase_11 AC 71 ms
71,040 KB
testcase_12 AC 73 ms
71,396 KB
testcase_13 AC 72 ms
71,292 KB
testcase_14 AC 83 ms
75,640 KB
testcase_15 AC 75 ms
75,940 KB
testcase_16 AC 71 ms
71,292 KB
testcase_17 AC 74 ms
75,776 KB
testcase_18 AC 72 ms
71,196 KB
testcase_19 AC 73 ms
71,092 KB
testcase_20 AC 71 ms
71,292 KB
testcase_21 AC 75 ms
75,544 KB
testcase_22 AC 77 ms
75,812 KB
testcase_23 AC 77 ms
75,728 KB
testcase_24 AC 73 ms
71,200 KB
権限があれば一括ダウンロードができます

ソースコード

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