QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#7490. 我回来了

Statistics

题目描述

珂朵莉在玩炉石传说的时候总是打不出教科书般的亵渎,于是他重新写了一个炉石传说’,并且将亵渎的描述改为:“等概率随机在 $[L,R]$ 中选出一个整数作为伤害值 $d$,对所有随从造成 $d$ 点伤害,如果有随从死亡,则再次施放该法术,但伤害值不重新随机;如果没有随从死亡,则停止释放”,还去掉了场面上随从上限和亵渎最多触发14次的限制。

珂朵莉不知道这个改版亵渎的效果怎么样,于是他打算进行一些测试,其中共进行 $m$ 次如下类型的操作:

  1. 在场面上加入一个血量为 $h$ 的随从,这里随从的血量都不能超过 $n$;
  2. 给定 $L, R$,询问亵渎期望触发多少次;

珂朵莉只会做操作1,于是他就把操作2交给你啦。

输入格式

第一行两个由空格分隔的整数 $n\;m$;

接下来 $m$ 行,每行表示一次操作,操作1表示为 $1\;h$,操作2表示为 $2\;L\;R$;

输出格式

为避免输出小数,对每次操作2,输出一个整数表示期望值与 $(R-L+1)$ 的乘积。

样例 #1

样例输入 #1

10 10
2 7 9
1 6
2 7 10
1 10
1 7
2 7 10
1 7
1 1
2 6 7
1 4

样例输出 #1

3
8
11
6

提示

Idea:oscar,Solution:ccz181078,Code:ccz181078,Data:nzhtl1477

对于 $100\%$ 的数据,保证: $1\le n\le 10^5$,每次1操作有 $1\le h\le n$,每次2操作有 $1\le L\le R\le n$; $1\le m\le 10^6$; 以上所有数值均为整数。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.