A. 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
a3 third 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 1 1
4
Output
YES
Input
1 1 3
2 3 4
2
Output
YES
Input
1 0 0
1 0 0
1
Output
NO
水题不解释
#include <iostream>
using namespace std;
int main()
{
int n,a1,a2,a3,b1,b2,b3;
cin>>a1>>a2>>a3>>b1>>b2>>b3>>n;
if(n>=(a1+a2+a3+4)/5+(b1+b2+b3+9)/10)
cout<<"YES";
else
cout<<"NO"; }

版权声明:本文博主原创文章。博客,未经同意不得转载。

codeforces #256 A. Rewards的更多相关文章

  1. Codeforces #256 Div.2

    B. Suffix Structure 1. 先判断s去掉一些元素是否能构成t,如果可以就是automaton 判断的方法也很简单,two pointer,相同元素同时++,不相同s的指针++,如果t ...

  2. codeforces 256 div2 C. Painting Fence 分治

    C. Painting Fence time limit per test 1 second memory limit per test 512 megabytes input standard in ...

  3. Codeforces Round #256 (Div. 2) A. Rewards

    A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  4. Codeforces Round #256 (Div. 2) 题解

    Problem A: A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standar ...

  5. Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)

    转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...

  6. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)

    解题报告 意思就是说有n行柜子,放奖杯和奖牌.要求每行柜子要么全是奖杯要么全是奖牌,并且奖杯每行最多5个,奖牌最多10个. 直接把奖杯奖牌各自累加,分别出5和10,向上取整和N比較 #include ...

  7. CF#256(Div.2) A. Rewards

    A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  8. Codeforces Round #256 (Div. 2) B. Suffix Structures(模拟)

    题目链接:http://codeforces.com/contest/448/problem/B --------------------------------------------------- ...

  9. Codeforces Round #256 (Div. 2)

    A - Rewards 水题,把a累加,然后向上取整(double)a/5,把b累加,然后向上取整(double)b/10,然后判断a+b是不是大于n即可 #include <iostream& ...

随机推荐

  1. JSTL分割字符 fn:split()

    <%@ page language="java" contentType="text/html; charset=UTF-8"%><%@ ta ...

  2. WinDBG 技巧:如何生成Dump 文件(.dump 命令)

    程序崩溃(crash)的时候, 为了以后能够调试分析问题, 可以使用WinDBG要把当时程序内存空间数据都保存下来,生成的文件称为dump 文件. 步骤: 1) 打开WinDBG并将之Attach 到 ...

  3. DotNetBar怎样控制窗口样式

    DotNetBar怎样控制窗口样式 老帅  在C#中使用控件DevComponents.DotNetBar时,怎样创建一个美丽的窗口.并控制窗口样式呢? 1.新建一个DotNetBar窗口       ...

  4. NET MVC RazorEngine 解析模板生成静态页

    ASP.NET MVC 解析模板生成静态页一(RazorEngine) 简述 Razor是ASP.NET MVC 3中新加入的技术,以作为ASPX引擎的一个新的替代项.在早期的MVC版本中默认使用的是 ...

  5. 北京哪儿有卖tods豆豆鞋的?在线等答案、、、、(类似动物园、西单等地)_百度知道

    北京哪儿有卖tods豆豆鞋的?在线等答案....(类似动物园.西单等地)_百度知道 北京哪儿有卖tods豆豆鞋的?在线等答案....(类似动物园.西单等地)

  6. fragment Trying to instantiate a class com.example.testhuanxindemo.MyFragment that is not a Fragmen

    在使用fragment的时候,先创建了一个fragment,然后为他创建布局,并在oncreateview中返回载入该视图的后返回的view,在activity的布局文件里,使用xml布局,用frag ...

  7. contiki etimer部分

    1.前言     contiki是一款小型开源,易于移植的多任务操作系统,专门为无线传感网设计,适合内存受限制的网络系统.国内的研究和应用还处于初级阶段,甚至还不知道这个contiki如何发音,也没有 ...

  8. Linux源文件夹结构呈现

    1.arch文件夹: - 相关的存储在不同平台上的代码,每个平台都采用了不同的文件夹来区分. ******Alpha平台 ******Arm平台 ******Arv32平台 ******X86平台 2 ...

  9. ON、WHERE、HAVING的差别

    ON .WHERE.HAVING都能通过限制条件筛选数据,但他们的使用及其不同.以下我们来分析三者之间的差别. 1.       ON 和WHERE 全部的查询都回产生一个中间暂时报表,查询结果就是从 ...

  10. Erlangserver紧内存优化解决方案

    提出的问题:server100万人在线,16G内存快被吃光. 玩家进程占用内存偏高 解决方法: 第一步: erlang:system_info(process_count). 查看进程数目是否正常,是 ...