解题报告
意思就是说有n行柜子,放奖杯和奖牌。要求每行柜子要么全是奖杯要么全是奖牌,并且奖杯每行最多5个,奖牌最多10个。
直接把奖杯奖牌各自累加,分别出5和10,向上取整和N比較
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <stdlib.h>
  5. #include <algorithm>
  6. #include <cmath>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. double a[10],b[10],suma=0,sumb=0;
  12. int n,i,j;
  13. for(i=0; i<3; i++)
  14. {
  15. cin>>a[i];
  16. suma+=a[i];
  17. }
  18. for(i=0; i<3; i++)
  19. {
  20. cin>>b[i];
  21. sumb+=b[i];
  22. }
  23. cin>>n;
  24. suma=ceil(suma/5);
  25. sumb=ceil(sumb/10);
  26. if(suma+sumb>n)
  27. cout<<"NO"<<endl;
  28. else cout<<"YES"<<endl;
  29. return 0;
  30. }

Rewards
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Bizon the Champion is called the Champion for a reason.

Bizon the Champion has recently got a present — a new glass cupboard with n shelves and he decided to put all his presents there. All the presents can be
divided into two types: medals and cups. Bizon the Champion has a1 first
prize cups, a2 second
prize cups and a3third
prize cups. Besides, he has b1 first
prize medals, b2 second
prize medals and b3 third
prize medals.

Naturally, the rewards in the cupboard must look good, that's why Bizon the Champion decided to follow the rules:

  • any shelf cannot contain both cups and medals at the same time;
  • no shelf can contain more than five cups;
  • no shelf can have more than ten medals.

Help Bizon the Champion find out if we can put all the rewards so that all the conditions are fulfilled.

Input

The first line contains integers a1, a2 and a3 (0 ≤ a1, a2, a3 ≤ 100).
The second line contains integers b1, b2 and b3 (0 ≤ b1, b2, b3 ≤ 100).
The third line contains integer n (1 ≤ n ≤ 100).

The numbers in the lines are separated by single spaces.

Output

Print "YES" (without the quotes) if all the rewards can be put on the shelves in the described manner. Otherwise, print "NO"
(without the quotes).

Sample test(s)
input
  1. 1 1 1
  2. 1 1 1
  3. 4
output
  1. YES
input
  1. 1 1 3
  2. 2 3 4
  3. 2
output
  1. YES
input
  1. 1 0 0
  2. 1 0 0
  3. 1
output
  1. NO

Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)的更多相关文章

  1. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  2. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  3. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  4. Codeforces Round #190 (Div. 2) 水果俩水题

    后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...

  5. Codeforces Round #282 (Div. 1) A. Treasure 水题

    A. Treasure Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/494/problem/A ...

  6. Codeforces Round #327 (Div. 2) B. Rebranding 水题

    B. Rebranding Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem ...

  7. Codeforces Round #194 (Div. 1) B. Chips 水题

    B. Chips Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/333/problem/B D ...

  8. Codeforces Round #377 (Div. 2) C. Sanatorium 水题

    C. Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  9. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

随机推荐

  1. CentOS下的日志切割

    在Linux下,日志会不停的增长,为了防止日志文件过大,导致我们无法在日志中快速找到想要的信息,我们会定时对日志文件进行切割.在这里我将使用logrotate切割日志. (1).logrotate的配 ...

  2. [leetcode DP]70. Climbing Stairs

    一共有n个台阶,每次跳一个或者两个,有多少种走法,典型的Fibonacii问题 class Solution(object): def climbStairs(self, n): if n<0: ...

  3. dhcp 提示could not load neutron.agent

    错误日志如下: N版存在问题,其它版本不知道 解决方法(代码问题): /usr/lib/python2.7/site-packages/neutron/common/utils.py 在这个方法上(d ...

  4. C语言初始化

    注意:为什么要进行C语言环境的初始化?在没有进行C语言环境的初始化之前的初始化工作都是用汇编进行初始化的.比如核心初始化,和内存初始化 栈:栈帧:一个进程中一般会有多个函数,每一个函数都需要在内存中开 ...

  5. hdu 1514 记忆化搜索

    题意是给4堆(堆的高度小于等于40)有颜色(颜色的种类小于等于20)的物品,你有一个篮子最多能装5件物品,每次从这4堆物品里面任取一件物品放进篮子里,但是取每堆物品时,必须先取上面的物品,才能取下面的 ...

  6. react中的children使用方法

    使用过vue的小伙伴都知道vue中有个slot,也就是插槽,作用就是占位,那么再react中可以使用children来替代 父组件 render(){ return( <div> < ...

  7. git push时提示"fatal: The current branch master has no..."

    git push到远程仓库时提示:fatal: The current branch master2 has no upstream branch. To push the current branc ...

  8. Solution for sending Whatsapp via sqlite "INSERT INTO"

    I use something similar but thought I'd mention this 'bug' that can happen:when you INSERT '%wa_mess ...

  9. 通过adb把apk安装到系统分区

    通过adb把apk安装到系统分区 以谷歌拼音为例:GooglePinyin1.4.2.apk提取出so文件libjni_googlepinyinime_4.solibjni_googlepinyini ...

  10. 常见 core dump 原因分析signal 11 - SIGSEGV

    signal 6 - SIGABRT free 多次 char *p = malloc(100); free(p); free(p); fclose 多次 // fclose 内部调用 free FI ...