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

    problems http://gdoi.sysu.edu.cn/wp-content/uploads/2015/03/GDKOI-2015-day1.pdf http://gdoi.sysu.edu ...

  2. Go语言的构建方法总结

    趁着近期要换工作的空闲时间,看了一下Go语言,与C++相比,Go语言的确在不少地方轻便了不少,例如:增加了内置的字符串类型.多个返回值.支持协程.简单的构建方法等等.使得在生产效率方面有了不少的提高. ...

  3. pyglet: a cross-platform windowing and multimedia

    pyglet pyglet: a cross-platform windowing and multimedia library for Python.

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

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

  5. c语言结构体数组定义的三种方式

    struct dangdang { ]; ]; ]; int num; int bugnum; ]; ]; double RMB; int dangdang;//成员名可以和类名同名 }ddd[];/ ...

  6. Java IO :文件

    在java应用程序中,文件是一种常用的数据源或者存储数据的媒介.所以这一小节将会对Java中文件的使用做一个简短的概述.这里只提供一些必要的知识点. 通过Java IO读文件 如果你需要在不同端之间读 ...

  7. JMeter Building a Database Test Plan

    Building a Database Test Plan In this section, you will learn how to create a basic Test Planto test ...

  8. 单片机脚本语言-移植lua到stm32-MDK

    Lua简单介绍 Lua[1]  是一个小巧的脚本语言.作者是巴西人.该语言的设计目的是为了嵌入应用程序中,从而为应用程序提供灵活的扩展和定制功能. Lua脚本能够非常easy的被C/C++ 代码调用, ...

  9. .NET基础拾遗(4)委托和事件2

    事件 事件是对象发送的消息,以发信号通知操作的发生.操作可能是由用户交互(例如鼠标单击)引起的,也可能是由某些其他的程序逻辑触发的. 引发事件的对象称为事件发送方.捕获事件并对其作出响应的对象叫做事件 ...

  10. oracle datetime

    to_date('" + Convert.ToDateTime(TCRQ).ToString("yyyy-MM-dd")+"','YYYY-MM-DD'), C ...