結果
| 問題 |
No.2001 Distanced Triple
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-05-04 02:19:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 405 bytes |
| コンパイル時間 | 165 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-21 23:53:34 |
| 合計ジャッジ時間 | 2,255 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
import sys
input = sys.stdin.readline
L,R=map(int,input().split())
A,B,C=map(int,input().split())
mod=998244353
R-=L
if R<C:
print(0)
exit()
if (R+1)-A-B<=0:
print(0)
exit()
"""
ANS=0
for i in range(1,R-C+2):
print(((R+2)-A-B-i),i)
ANS+=((R+2)-A-B-i)*i
print(ANS)
"""
def calcsum(c,n):
return c*n*(n+1)//2-n*(n+1)*(2*n+1)//6
print(calcsum((R+2)-A-B,R-max(C,A+B)+1)%mod)
titia