結果

問題 No.2176 LRM Question 1
ユーザー vwxyzvwxyz
提出日時 2023-06-14 16:34:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 919 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 57,220 KB
最終ジャッジ日時 2023-09-05 03:55:04
合計ジャッジ時間 10,763 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,408 KB
testcase_01 AC 35 ms
10,308 KB
testcase_02 AC 669 ms
25,720 KB
testcase_03 AC 35 ms
10,352 KB
testcase_04 WA -
testcase_05 AC 59 ms
10,744 KB
testcase_06 WA -
testcase_07 AC 55 ms
10,828 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 539 ms
23,612 KB
testcase_11 AC 32 ms
10,380 KB
testcase_12 AC 33 ms
10,436 KB
testcase_13 AC 593 ms
18,084 KB
testcase_14 AC 836 ms
57,220 KB
testcase_15 AC 523 ms
25,104 KB
testcase_16 AC 428 ms
20,440 KB
testcase_17 AC 46 ms
10,500 KB
testcase_18 AC 556 ms
17,248 KB
testcase_19 AC 390 ms
14,920 KB
testcase_20 AC 162 ms
11,988 KB
testcase_21 AC 295 ms
16,572 KB
testcase_22 AC 59 ms
10,932 KB
testcase_23 AC 277 ms
15,856 KB
testcase_24 AC 289 ms
13,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

L,R,M=map(int,readline().split())
fact=[1]*(M+1)
for m in range(1,M+1):
    fact[m]=fact[m-1]*m
    fact[m]%=M
for m in range(1,M+1):
    fact[m]*=fact[m-1]
    fact[m]%=M
L=min(L,M+1)
R=min(R,M+1)
ans=sum(fact[L:R])%M
print(ans)
0