結果
| 問題 | No.2176 LRM Question 1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-06 22:49:19 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 575 ms / 2,000 ms |
| コード長 | 346 bytes |
| 記録 | |
| コンパイル時間 | 470 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,448 KB |
| 最終ジャッジ日時 | 2026-05-24 10:02:23 |
| 合計ジャッジ時間 | 4,450 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
import math
import sys
l,r,m=map(int,input().split())
ans=1
temp1=1
for i in range(1,l+1):
temp1*=i
ans*=temp1%m
if ans==0:
print(0)
sys.exit()
temp=ans
for i in range(l+1,r+1):
temp1=temp1*i%m
temp=temp*temp1%m
ans+=temp%m
ans=ans%m
if temp%m==0:
print(ans)
sys.exit()
print(ans)