Codeforces 439A, the Singer and Churu, the Joker(水题)
2014-06-15 22:47
375 查看
题目链接:Codeforces 439A Devu, the Singer and Churu, the Joker
题目大意:Devu是一个歌唱家,Churu是个小丑,他们被共同邀请参加一个表演秀,Devu准备了n首歌曲,每首歌曲演唱需要ti时间,Churu负责讲笑话,每个笑话5分钟。现在节目的总时长为d,Devu每两首歌之间要休息10分钟,表演的总时间不能超过d,Churu非常亢奋,问Churu最多可以讲多少个笑话,前提是Devu必须唱完所有的歌,因为所有的人都是来听Devu唱歌的,否则输出-1。
解题思路:两首歌中间的10分钟肯定个Churu讲两个笑话,这样算时间有剩就都给Churu讲笑话用。如果这样都不够用那么久输出-1。
题目大意:Devu是一个歌唱家,Churu是个小丑,他们被共同邀请参加一个表演秀,Devu准备了n首歌曲,每首歌曲演唱需要ti时间,Churu负责讲笑话,每个笑话5分钟。现在节目的总时长为d,Devu每两首歌之间要休息10分钟,表演的总时间不能超过d,Churu非常亢奋,问Churu最多可以讲多少个笑话,前提是Devu必须唱完所有的歌,因为所有的人都是来听Devu唱歌的,否则输出-1。
解题思路:两首歌中间的10分钟肯定个Churu讲两个笑话,这样算时间有剩就都给Churu讲笑话用。如果这样都不够用那么久输出-1。
#include <cstdio> #include <cstring> int main () { int n, d, t, s = 0; scanf("%d%d", &n, &d); for (int i = 0; i < n; i++) { scanf("%d", &t); s += t; } s += (n - 1) * 10; if (s > d) printf("-1\n"); else { int tmp = d - s; printf("%d\n", n * 2 - 2 + tmp / 5); } return 0; }
相关文章推荐
- codeforces—— 439A —— Devu, the Singer and Churu, the Joker
- 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 Round #251 (Div. 2) A - Devu, the Singer and Churu, the Joker
- Devu, the Singer and Churu, the Joker
- A. Devu, the Singer and Churu, the Joker
- G - The Child and Set-CodeForces 437B-水题
- codeforces 558B B. Amr and The Large Array(水题)
- H - The Child and Toy-CodeForces 437C-水题
- Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones 水题
- CodeForces 288C - Polo the Penguin and XOR operation(思维)
- Codeforces 467A George and Accommodation(水题)
- HDU 1029.Ignatius and the Princess IV【数据弱鸡】【咦,水题!】【8月20】
- Appleman and Toastman - CodeForces 461 A 水题
- codeforces 289B - Polo the Penguin and Matrix 二分+dp
- Codeforces-289b J Polo the Penguin and Matrix
- CodeForces 437D -- The Child and Zoo(并查集+贪心)