QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#380486 | #8565. Basic Blooms | ucup-team1766# | RE | 0ms | 0kb | Python3 | 607b | 2024-04-07 04:46:05 | 2024-04-07 04:46:06 |
answer
from heapq import *
MOD = 998244353
flowers = [0] * 1000001
heap = []
for b in range(2,17):
for d in range(1,b):
heappush(heap, [d, b, d, d])
for i in range(1,len(flowers)):
v,b,d,m = heappop(heap)
if v != flowers[i-1]:
flowers[i] = m % MOD
heappush(heap, [v*b+d, b, d, (m*b+d)%MOD])
if i % 100000 == 0:
for i in range(len(heap)):
heap[i][0] /= heap[0][0]
for i in range(1,len(flowers)):
flowers[i] = (flowers[i] + flowers[i-1]) % MOD
t = int(input())
for _ in range(t):
a, b = map(int,input().split())
print(flowers[b]-flowers[a-1])
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
3 1 2 1 10 15 2000