A. Power Consumption Calculation

题目连接:

http://www.codeforces.com/contest/10/problem/A

Description

Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1 watt per minute. T1 minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to P2 watt per minute. Finally, after T2 minutes from the start of the screensaver, laptop switches to the "sleep" mode and consumes P3 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 [l1, r1], [l2, r2], ..., [ln, rn]. 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].

Input

The first line contains 6 integer numbers n, P1, P2, P3, T1, T2 (1 ≤ n ≤ 100, 0 ≤ P1, P2, P3 ≤ 100, 1 ≤ T1, T2 ≤ 60). The following n lines contain description of Tom's work. Each i-th of these lines contains two space-separated integers li and ri (0 ≤ li < ri ≤ 1440, ri < li + 1 for i < n), which stand for the start and the end of the i-th period of work.

Output

Output the answer to the problem.

Sample Input

1 3 2 1 5 10

0 10

Sample Output

30

Hint

题意

有一台电脑,在活跃状态下,每秒钟耗能p1,在没人碰之后的t1秒后,进入休息状态,每秒钟耗能p2,如果再有t3秒没人碰的话,就会进入睡眠状态,每秒钟耗能p3

给你这个人碰电脑的区间时间,问你这台电脑的耗能是多少

题解:

数据范围太小,直接暴力就好了……

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn = 105;
int n,p1,p2,p3,t1,t2;
pair<int,int> Q[maxn];
int p[3000];
int main()
{
scanf("%d%d%d%d%d%d",&n,&p1,&p2,&p3,&t1,&t2);
for(int i=1;i<=n;i++)scanf("%d%d",&Q[i].first,&Q[i].second);
for(int i=1;i<=n;i++)for(int j=Q[i].first;j<=Q[i].second;j++)
p[j]=1;
long long ans = 0;
int type=0,now=0;
for(int i=Q[1].first;i<Q[n].second;i++)
{
if(p[i]==1)now=0,ans+=p1;
else if(now>=t1+t2)ans+=p3;
else if(now>=t1)ans+=p2;
else ans+=p1;
now++;
}
cout<<ans<<endl;
}

Codeforces Beta Round #10 A. Power Consumption Calculation 水题的更多相关文章

  1. Codeforces Beta Round #14 (Div. 2) A. Letter 水题

    A. Letter 题目连接: http://www.codeforces.com/contest/14/problem/A Description A boy Bob likes to draw. ...

  2. Codeforces Beta Round #7 A. Kalevitch and Chess 水题

    A. Kalevitch and Chess 题目连接: http://www.codeforces.com/contest/7/problem/A Description A famous Berl ...

  3. Codeforces Beta Round #97 (Div. 1) A. Replacement 水题

    A. Replacement 题目连接: http://codeforces.com/contest/135/problem/A Description Little Petya very much ...

  4. Codeforces Beta Round #10 D. LCIS

    题目链接: http://www.codeforces.com/contest/10/problem/D D. LCIS time limit per test:1 secondmemory limi ...

  5. Codeforces Beta Round #10 D. LCIS 动态规划

    D. LCIS 题目连接: http://www.codeforces.com/contest/10/problem/D Description This problem differs from o ...

  6. Codeforces Beta Round #10 C. Digital Root 数学

    C. Digital Root 题目连接: http://www.codeforces.com/contest/10/problem/C Description Not long ago Billy ...

  7. Codeforces Beta Round #10 B. Cinema Cashier 暴力

    B. Cinema Cashier 题目连接: http://www.codeforces.com/contest/10/problem/B Description All cinema halls ...

  8. Codeforces Beta Round #10 D. LCIS(DP&amp;LCIS)

    D. LCIS time limit per test 1 second memory limit per test 256 megabytes input standard input output ...

  9. Codeforces Beta Round #10 B. Cinema Cashier (树状数组)

    题目大意: n波人去k*k的电影院看电影. 要尽量往中间坐,往前坐. 直接枚举,贪心,能坐就坐,坐在离中心近期的地方. #include <cstdio> #include <ios ...

随机推荐

  1. 技巧之如何快速使用websocket来监控标准输出

    为啥是Websocket 服务端可以主动推送消息到浏览器端.比如服务端实时在打印日志,这是一个标准输出,可以实时将日志推送到浏览器. 为啥用websocketd (https://github.com ...

  2. MYSQL的隐式类型转换

    官方文档中是这么说的 当操作者使用不同类型的操作数,操作数类型兼容的出现使 转换.一些 发生隐式转换.例如,MySQL会自动 将数字转换为字符串的必要,反之亦然. 也可以将数字转换为字符串明确 使用( ...

  3. 【转载】selenium之 定位以及切换frame(iframe)

    更多关于python selenium的文章,请关注我的专栏:Python Selenium自动化测试详解 总有人看不明白,以防万一,先在开头大写加粗说明一下: frameset不用切,frame需层 ...

  4. [转载]锁无关的数据结构与Hazard指针——操纵有限的资源

    Lock-Free Data Structures with Hazard Pointers 锁无关的数据结构与Hazard指针----操纵有限的资源 By Andrei Alexandrescu a ...

  5. SwitchSharp代理插件的安装和使用

    参考链接: http://bbs.feng.com/read-htm-tid-8227283.html 安装参考链接: http://jingyan.baidu.com/article/380abd0 ...

  6. List基本用法

    List最为Collection接口的子接口,当然可以使用Collection接口里的全部方法.而且由于List是有序集合,因此List集合里增加了一些根据索引来操作集合元素的方法: public c ...

  7. java基础9 main函数、this、static、super、final、instanceof 关键字

    一.main函数详解 1.public:公共的.权限是最大的,在任何情况都可以访问  原因:为了保证jvm在任何情况下都可以访问到main法2.static:静态,静态可以让jvm调用更方便,不需要用 ...

  8. ntp 校时程序

    //effect:send ntp packet and get the ntp packet ,make the time OK//2014.7.31 is OK//#include <sys ...

  9. 1.第一个hello word

    1.生产者 #!/usr/bin/env python import pika connection = pika.BlockingConnection(pika.ConnectionParamete ...

  10. 小程序授权怎么写 , 用户点击取消授权 调用 wx.authorize

    点击获取授权 onLoad: function (options) { console.log("onLoad====="); var that=this; wx.getUserI ...