测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A7786. Power Consumption Calculation

编程题 普及/提高-

题目描述

Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes $P_{1}$ watt per minute. $T_{1}$ minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to $P_{2}$ watt per minute. Finally, after $T_{2}$ minutes from the start of the screensaver, laptop switches to the "sleep" mode and consumes $P_{3}$ watt per minute. If Tom moves the mouse or touches the keyboard when the laptop is in the second or in the third mode, it switches to the first (normal) mode. Tom's work with the laptop can be divided into $n$ time periods $[l_{1},r_{1}],[l_{2},r_{2}],...,[l_{n},r_{n}]$ . During each interval Tom continuously moves the mouse and presses buttons on the keyboard. Between the periods Tom stays away from the laptop. Find out the total amount of power consumed by the laptop during the period $[l_{1},r_{n}]$ .

计算功率消耗

Tom对他最喜爱的笔记本电脑的功耗很感兴趣。他的笔记本电脑有三种模式。在正常模式下,笔记本电脑每分钟消耗 $P_1$ 瓦特。在 Tom 上次移动鼠标或触摸键盘后的 $T_1$ 分钟后,屏幕保护程序启动,功耗变为 $P_2$ 瓦特每分钟。最后,在屏幕保护程序开始后的 $T_2$ 分钟后,笔记本电脑切换到 "睡眠" 模式,并消耗 $P_3$ 瓦特每分钟。如果 Tom 在笔记本电脑处于第二或第三模式时移动鼠标或触摸键盘,则它将切换到第一(正常)模式。Tom 使用笔记本电脑的工作可以分为 $n$ 个时间段 $[l_1, r_1], [l_2, r_2], ..., [l_n, r_n]$。在每个区间内,Tom 连续移动鼠标并按键盘上的按钮。在这些时间段之间,Tom 远离笔记本电脑。

请你找出笔记本电脑在时间段 $[l_1, r_n]$ 内消耗的总功率。

感谢[Macw](https://www.acgo.cn/person/929871)提供翻译

输入格式

The first line contains 6 integer numbers $n$ , $P_{1}$ , $P_{2}$ , $P_{3}$ , $T_{1}$ , $T_{2}$ ( $1<=n<=100,0<=P_{1},P_{2},P_{3}<=100,1<=T_{1},T_{2}<=60$ ). The following $n$ lines contain description of Tom's work. Each $i$ -th of these lines contains two space-separated integers $l_{i}$ and $r_{i}$ ( $0<=l_{i}<r_{i}<=1440$ , $r_{i}<l_{i+1}$ for $i<n$ ), which stand for the start and the end of the $i$ -th period of work.

输入包含多行。
第一行输入六个整数,分别为 $n, P_1, P_2, P_3, T_1, T_2$。其中 $1 \le n \le 1000, 0 \le P_1, P_2, P_3 \le 100, 1 \le T_1, T_2 \le 60$。
接下来的 $n$ 行,每一行输入两个整数 $l_i, r_i$。保证 $0 \le l_i < r_i \le 1440, r_i < l_{i+1} \text{for} i < n$。

输出格式

Output the answer to the problem.

输出一个整数,表示本题的答案。

输入输出样例

输入 #1
1 3 2 1 5 10
0 10
输出 #1
30
输入 #2
2 8 4 2 5 10
20 30
50 100
输出 #2
570

说明/提示

**请注意,本题空间限制为256MB,是默认空间限制的两倍。**
上一题 去做题 下一题