結果

問題 No.2176 LRM Question 1
ユーザー タコイモタコイモ
提出日時 2023-01-06 21:40:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 568 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 11,012 KB
実行使用メモリ 8,780 KB
最終ジャッジ日時 2023-08-20 14:44:01
合計ジャッジ時間 4,549 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,588 KB
testcase_01 AC 19 ms
8,592 KB
testcase_02 AC 453 ms
8,568 KB
testcase_03 AC 19 ms
8,780 KB
testcase_04 AC 19 ms
8,736 KB
testcase_05 AC 25 ms
8,744 KB
testcase_06 AC 19 ms
8,572 KB
testcase_07 AC 28 ms
8,612 KB
testcase_08 AC 20 ms
8,752 KB
testcase_09 AC 19 ms
8,752 KB
testcase_10 AC 367 ms
8,688 KB
testcase_11 AC 19 ms
8,576 KB
testcase_12 AC 19 ms
8,744 KB
testcase_13 AC 19 ms
8,588 KB
testcase_14 AC 568 ms
8,736 KB
testcase_15 AC 349 ms
8,568 KB
testcase_16 AC 300 ms
8,764 KB
testcase_17 AC 27 ms
8,756 KB
testcase_18 AC 19 ms
8,572 KB
testcase_19 AC 19 ms
8,700 KB
testcase_20 AC 19 ms
8,684 KB
testcase_21 AC 174 ms
8,592 KB
testcase_22 AC 34 ms
8,764 KB
testcase_23 AC 150 ms
8,632 KB
testcase_24 AC 20 ms
8,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(500000)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
from collections import defaultdict,deque
import bisect
import itertools
dic = defaultdict(int)
d = deque()
L,R,M = MI()
ans = 0
count = 1
cc = 1
if M <= L:
  print(0)
  exit()
for i in range(1,L+1):
  cc = (cc*i)%M
  count = (count*cc)%M
ans = count
for i in range(L+1,R+1):
  if i >= M:
    break
  else:
    cc = (cc*i)%M
    count = (count*cc)%M
    ans = (ans+count)%M
print(ans)

0