CF10A.Power Consumption Calculation

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1P_{1} watt per minute. T1T_{1} minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to P2P_{2} watt per minute. Finally, after T2T_{2} minutes from the start of the screensaver, laptop switches to the "sleep" mode and consumes P3P_{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 nn time periods [l1,r1],[l2,r2],...,[ln,rn][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 [l1,rn][l_{1},r_{n}] .

计算功率消耗

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

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

感谢Macw提供翻译

输入格式

The first line contains 6 integer numbers nn , P1P_{1} , P2P_{2} , P3P_{3} , T1T_{1} , T2T_{2} ( 1<=n<=100,0<=P1,P2,P3<=100,1<=T1,T2<=601<=n<=100,0<=P_{1},P_{2},P_{3}<=100,1<=T_{1},T_{2}<=60 ). The following nn lines contain description of Tom's work. Each ii -th of these lines contains two space-separated integers lil_{i} and rir_{i} ( 0<=li<ri<=14400<=l_{i}<r_{i}<=1440 , ri<li+1r_{i}<l_{i+1} for i<ni<n ), which stand for the start and the end of the ii -th period of work.

输入包含多行。
第一行输入六个整数,分别为 n,P1,P2,P3,T1,T2n, P_1, P_2, P_3, T_1, T_2。其中 1n1000,0P1,P2,P3100,1T1,T2601 \le n \le 1000, 0 \le P_1, P_2, P_3 \le 100, 1 \le T_1, T_2 \le 60
接下来的 nn 行,每一行输入两个整数 li,ril_i, r_i。保证 0li<ri1440,ri<li+1fori<n0 \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,是默认空间限制的两倍。

首页