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

额……好久没刷cf了

第一题模拟一下

#include<cstdio>
#define LL long long
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
LL a,b,c,d,e,f,g,h,n;
int main()
{
scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
g=a+b+c;
h=d+e+f;
scanf("%lld",&n);
if (g%5)n--;
if (h%10)n--;
if (g/5+h/10<=n) printf("YES");
else printf("NO");
return 0;
}

cf448A Rewards的更多相关文章

  1. codeforces #256 A. Rewards

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

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

  3. 45 The Effect of External Rewards on Behavior 外界奖励对行为的影响

    The Effect of External Rewards on Behavior 外界奖励对行为的影响 ①Psychologists take opposing views on how exte ...

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

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

  5. Would Your Work Habits Change if You Were Paid by the Job?

    原文地址:http://success-sys.com/2016/09/26/would-your-work-habits-change-if-you-were-paid-by-the-job/ A ...

  6. 7 COMPELLING REASONS YOU NEED TO START THE BUSINESS YOU’VE ALWAYS WANTED

    原文链接:http://lesseesadvocate.com/7-compelling-reasons-need-start-business-youve-always-wanted/ Don’t ...

  7. Machine Learning Algorithms Study Notes(5)—Reinforcement Learning

    Reinforcement Learning 对于控制决策问题的解决思路:设计一个回报函数(reward function),如果learning agent(如上面的四足机器人.象棋AI程序)在决定 ...

  8. Codeforces Round #256 (Div. 2)

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

  9. POMDP

    本文转自:http://www.pomdp.org/ 一.Background on POMDPs We assume that the reader is familiar with the val ...

随机推荐

  1. hdu4085

    http://acm.hdu.edu.cn/showproblem.php?pid=4085 斯坦纳树. 用状压DP. 一共有2K个关键点:1,2...,K和N-K+1,N-K+2...,N,我们用一 ...

  2. CSDN第四届在线编程大赛2014初赛:带通配符的数

    题目要求: 输入参数:参数A,含有任意个数的?的数值字符串,如:12?4,?代表一位任意数             参数B,不含?的数值字符串,长度与参数A一致输出结果:参数A比参数B大的可能数值个数 ...

  3. hdu1824-Let's go home:图论2-SAT

    关键在于找出一定矛盾的条件,设一队的3个人为(a,b,c),a为队长,那么(a不留下,b不留下)矛盾,(a不留下,c不留下)矛盾; 对于每一对队员,(a留下,b留下)矛盾. 把模型建好,剩下的就是套模 ...

  4. mysql c haracter

    基本概念 • 字符(Character)是指人类语言中最小的表义符号.例如’A'.’B'等:• 给定一系列字符,对每个字符赋予一个数值,用数值来代表对应的字符,这一数值就是字符的编码(Encoding ...

  5. cocos2d-x ios 设置横屏/竖屏(全)

    Cocos2d-x项目\iOS\RootViewController.mm文件中. 以下方法任选其一即可…      本人机子函数二ok! 函数一: (BOOL)shouldAutorotateToI ...

  6. 马士兵 Servlet_JSP(2) JSP源代码)

    1.最简单的JSP HelloWorld.jsp <html>     <head>         <title>Hello</title>     ...

  7. testng xml 示例

    TestNG的DTD检查文件:http://testng.org/testng-1.0.dtd.php 更多testng配置及说明,请移步http://testdoc.org/docmaster?pi ...

  8. Windows下模拟Linux开发

    1.背景 Linux环境下开发是大势所趋,也是开发者必须掌握的技能.然windows系统已深入人心,实在不想放弃windows下的成熟应用,因此可以在Windows上模拟一个Linux系统.这样就满足 ...

  9. 使用AWS的EC2服务器,进行跳墙

    选Ubuntu的服务器 一开始先设置Root,命令:su root 在安装之前,先Update一下源:apt-get update update完就可以安装: 1.安装pi,命令:apt-get in ...

  10. git config配置文件 (共有三个配置文件)

    设置 git status的颜色. git config --global color.status auto 一.Git已经在你的系统中了,你会做一些事情来客户化你的Git环境.你只需要做这些设置一 ...