結果

問題 No.2176 LRM Question 1
ユーザー Taku000Taku000
提出日時 2023-01-28 14:43:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 426 bytes
コンパイル時間 898 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 258,096 KB
最終ジャッジ日時 2023-09-11 03:56:31
合計ジャッジ時間 5,810 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,696 KB
testcase_01 AC 75 ms
71,420 KB
testcase_02 AC 78 ms
71,212 KB
testcase_03 AC 77 ms
71,296 KB
testcase_04 AC 76 ms
71,452 KB
testcase_05 AC 77 ms
71,232 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

l,r,m = map(int, input().split())
z = 1
k = 1
for i in range(1, l + 1):
    z *= i
    k *= z
    if k % m == 0:
        print(0)
        exit()
f = k
if f % m == 0:
    print(0)
    exit()
count = 0
prev = -1
for i in range(l + 1, r + 1):
    z *= i
    k *= z
    f += k
    r = f%m
    if prev == r:
        count += 1
    else:
        count = 0
    if count > 100:
        print(r)
        exit()
    prev = r
print(f%m)
0