Codeforces Beta Round #10 A. Power Consumption Calculation 水题
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 水题的更多相关文章
- 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. ...
- Codeforces Beta Round #7 A. Kalevitch and Chess 水题
A. Kalevitch and Chess 题目连接: http://www.codeforces.com/contest/7/problem/A Description A famous Berl ...
- Codeforces Beta Round #97 (Div. 1) A. Replacement 水题
A. Replacement 题目连接: http://codeforces.com/contest/135/problem/A Description Little Petya very much ...
- Codeforces Beta Round #10 D. LCIS
题目链接: http://www.codeforces.com/contest/10/problem/D D. LCIS time limit per test:1 secondmemory limi ...
- Codeforces Beta Round #10 D. LCIS 动态规划
D. LCIS 题目连接: http://www.codeforces.com/contest/10/problem/D Description This problem differs from o ...
- Codeforces Beta Round #10 C. Digital Root 数学
C. Digital Root 题目连接: http://www.codeforces.com/contest/10/problem/C Description Not long ago Billy ...
- Codeforces Beta Round #10 B. Cinema Cashier 暴力
B. Cinema Cashier 题目连接: http://www.codeforces.com/contest/10/problem/B Description All cinema halls ...
- Codeforces Beta Round #10 D. LCIS(DP&LCIS)
D. LCIS time limit per test 1 second memory limit per test 256 megabytes input standard input output ...
- Codeforces Beta Round #10 B. Cinema Cashier (树状数组)
题目大意: n波人去k*k的电影院看电影. 要尽量往中间坐,往前坐. 直接枚举,贪心,能坐就坐,坐在离中心近期的地方. #include <cstdio> #include <ios ...
随机推荐
- hdu 5328 Problem Killer(杭电多校赛第四场)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5328 题目大意:找到连续的最长的等差数列or等比数列. 解题思路:1.等差等比的性质有很多.其中比较重 ...
- oracle 归档模式、补充日志
1.归档模式: Oracle数据库有联机重做日志,这个日志是记录对数据库所做的修改,比如插入,删除,更新数据等,对这些操作都会记录在联机重做日志里.一般数据库至少要有2个联机重做日志组.当一个联机重做 ...
- flask基础之jijia2模板语言进阶(三)
前言 前面学习了jijia2模板语言的一些基础知识,接下来继续深挖jijia2语言的用法. 系列文章 flask基础之安装和使用入门(一) flask基础之jijia2模板使用基础(二) 控制语句 和 ...
- kvm命令参数记录
/usr/libexec/qemu-kvm -cpu host -m 1024 -enable-kvm -drive file=/var/lib/libvirt/images/zxc_linux1.i ...
- 64_p9
python2-termcolor-1.1.0-11.fc26.noarch.rpm 12-Feb-2017 14:05 13610 python2-terminado-0.6-2.fc26.noar ...
- selenium只打开一个浏览器窗口
from selenium.webdriver import Remote from selenium.webdriver.chrome import options from selenium.co ...
- 大型网站的 HTTPS 实践(一)—— HTTPS 协议和原理(转)
原文链接:http://op.baidu.com/2015/04/https-s01a01/ 1 前言 百度已经于近日上线了全站 HTTPS 的安全搜索,默认会将 HTTP 请求跳转成 HTTPS.本 ...
- fiddler添加监测请求的 ip地址
本文转载自:http://www.jackness.org/2014/12/26/%E7%BB%99fiddler%E6%B7%BB%E5%8A%A0%E7%9B%91%E6%B5%8B%E8%AF% ...
- JMeter -----设置代理抓取web的HTTPS请求,“您的连接不是私密链接”的处理方案
出现如上截图的问题,已确定将网站的证书.jmeter的证书均安装完成,并未提示报错,但是在配置代理后,刷新网站抓取请求时总是提示如上报错 解决方案: 1.关闭电脑上的所有浏览器 2.打开“终端”运行: ...
- 【转】【delphi】ClientDataSet详细解读
原文:http://www.cnblogs.com/lcw/p/3496764.html TClientDataSet的基本属性和方法 TClientDataSet控件继承自TDataSet,其数据存 ...