CF448A.Rewards

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 _a_1 first prize cups, _a_2 second prize cups and _a_3 third prize cups. Besides, he has _b_1 first prize medals, _b_2 second prize medals and _b_3 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.

冠军比松之所以被称为冠军,是有原因的。

最近,冠军比松收到了一份礼物——一个有 nn 层架子的新玻璃橱柜,他决定把所有的奖品都放进去。所有奖品可分为两类:奖杯和奖牌。冠军比松拥有 a1a_1 个一等奖奖杯、a2a_2 个二等奖奖杯和 a3a_3 个三等奖奖杯;此外,他还拥有 b1b_1 枚一等奖奖牌、b2b_2 枚二等奖奖牌和 b3b_3 枚三等奖奖牌。

显然,橱柜中的奖品必须看起来美观,因此冠军比松决定遵循以下规则:

  • 任何一层架子上不能同时放置奖杯和奖牌;
  • 任何一层架子上最多只能放五个奖杯;
  • 任何一层架子上最多只能放十枚奖牌。

请帮助冠军比松判断:能否将所有奖品全部放入橱柜中,且满足上述所有条件?

输入格式

The first line contains integers _a_1, _a_2 and _a_3 (0 ≤ _a_1, _a_2, _a_3 ≤ 100). The second line contains integers _b_1, _b_2 and _b_3 (0 ≤ _b_1, _b_2, _b_3 ≤ 100). The third line contains integer n (1 ≤ n ≤ 100).

The numbers in the lines are separated by single spaces.

第一行包含整数 a1a_1、a2a_2 和 a3a_3(0 ≤ a1, a2, a3 ≤ 1000 \leq a_1, a_2, a_3 \leq 100)。
第二行包含整数 b1b_1、b2b_2 和 b3b_3(0 ≤ b1, b2, b3 ≤ 1000 \leq b_1, b_2, b_3 \leq 100)。
第三行包含整数 nn(1 ≤ n ≤ 1001 \leq n \leq 100)。

每行中的数字以单个空格分隔。

输出格式

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).

如果所有奖品都能以所述方式放置在书架上,则输出 "YES"(不带引号);否则,输出 "NO"(不带引号)。

输入输出样例

  • 输入#1

    1 1 1
    1 1 1
    4

    输出#1

    YES
  • 输入#2

    1 1 3
    2 3 4
    2

    输出#2

    YES
  • 输入#3

    1 0 0
    1 0 0
    1

    输出#3

    NO

输入解题思路,AI测评打分。不知道怎么写?

首页