結果
問題 | No.2176 LRM Question 1 |
ユーザー |
|
提出日時 | 2023-01-06 21:40:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 665 ms / 2,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-30 17:29:48 |
合計ジャッジ時間 | 4,213 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
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)