Codeforces 439A Devu, the Singer and Churu, the Joker
来源:互联网 发布:剑灵人族男性捏脸数据 编辑:程序博客网 时间:2024/05/22 17:02
题意:
Devu有n首歌必须唱,但是时间只有d,给出每首歌的时间t[i]分钟,每唱一首歌后他就得休息10分钟。Churu想利用这些时间空余去讲笑话,每次讲5分钟。问在Devu完成所有歌的前提下,Churu讲笑话的个数最多多少个。
思路:
Devu休息10分钟Churu能讲2个笑话,最后一首歌唱完不休息,所以在Devu休息时Churu能够讲(n-1)*2的笑话,如果时间允许,他还能将(d-sum)/5的笑话。
#include<cstdio>const int MAX=105;int n,d,t[MAX];int main(){scanf("%d%d",&n,&d);int sum=(n-1)*10;for(int i=1;i<=n;i++){scanf("%d",&t[i]);sum+=t[i];}if(sum<=d) printf("%d\n",(n-1)*2+(d-sum)/5);else printf("-1\n");return 0;}
0 0
- Codeforces 439A Devu, the Singer and Churu, the Joker
- Codeforces 439 A. Devu, the Singer and Churu, the Joker
- Codeforces 439A Devu, the Singer and Churu, the Joker
- codeforces 439A Devu, the Singer and Churu, the Joker
- Codeforces Round #251(Div. 2) 439A. Devu, the Singer and Churu, the Joker 水题
- codeforces—— 439A —— Devu, the Singer and Churu, the Joker
- Devu, the Singer and Churu, the Joker
- A. Devu, the Singer and Churu, the Joker
- Codeforces 439A, the Singer and Churu, the Joker(水题)
- Codeforces 439C Devu and Partitioning of the Array
- Codeforces 439C Devu and Partitioning of the Array(模拟)
- Codeforces 439C Devu and Partitioning of the Array
- Codeforces 439C Devu and Partitioning of the Array
- Codeforces 439C Devu and Partitioning of the Array 模拟
- Codeforces 439B Devu, the Dumb Guy
- Codeforces 439 B. Devu, the Dumb Guy
- CodeForces 439B Devu, the Dumb Guy
- CodeForces 439B Devu, the Dumb Guy
- 【HD 2199】Can you solve this equation?
- Java 死锁的例子
- 数学 ( 微分方程+物理问题:狐狸追兔 )——Rower BO ( HDU 5761 )
- apache commons collections CollectionUtils工具类简单使用
- java 堆栈
- Codeforces 439A Devu, the Singer and Churu, the Joker
- 1108. Finding Average (20)
- android DDMS 连接真机(己ROOT),用file explore看不到data/data文件夹的解决办法
- 大数据Spark “蘑菇云”行动前传第8课:零基础实战Scala最常用数据结构Map和Tuple及Spark源码解析
- 第三届线下编程比赛
- 类与类之间的关系
- 【CodeForces】[372A]Counting Kangaroos is Fun
- 【POJ3067】Japan-区间求和
- 使用Git上传项目代码到github