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  


题意就是Bizon the Champion这个人得了非常多奖,有a1个一等奖奖杯。a2个二等奖奖杯。a3个三等奖奖杯。b1张一等奖奖状。b2张二等奖奖状,b3张三等奖奖状。如今给你n个柜子。问你能否将这些奖杯和奖状放下,规则是奖杯和奖状不能放在同一个柜子里。一个柜子最多仅仅能放5个奖杯或10张奖状。
解题思路:将现有的奖杯和奖状所须要的柜子书求出。假设小于n,则输出“YES”;否则输出“NO”。
#include<stdio.h>
int s[3],y[3];
int main()
{
int b,d,m;
scanf("%d %d %d",&s[0],&s[1],&s[2]);
int a=s[0]+s[1]+s[2]+4;//一个小技巧,加上4以后能够将不足5个所需的柜子书加上! b=a/5;
scanf("%d %d %d",&y[0],&y[1],&y[2]);
int c=y[0]+y[1]+y[2]+9;//同上
d=b/10;
scanf("%d",&m);
if(b+d>m)
printf("NO\n");
else
printf("YES\n");
return 0;
}

CF#256(Div.2) A. Rewards的更多相关文章

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

  2. CF #376 (Div. 2) C. dfs

    1.CF #376 (Div. 2)    C. Socks       dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...

  3. CF #375 (Div. 2) D. bfs

    1.CF #375 (Div. 2)  D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...

  4. CF #374 (Div. 2) D. 贪心,优先队列或set

    1.CF #374 (Div. 2)   D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...

  5. CF #374 (Div. 2) C. Journey dp

    1.CF #374 (Div. 2)    C.  Journey 2.总结:好题,这一道题,WA,MLE,TLE,RE,各种姿势都来了一遍.. 3.题意:有向无环图,找出第1个点到第n个点的一条路径 ...

  6. CF #371 (Div. 2) C、map标记

    1.CF #371 (Div. 2)   C. Sonya and Queries  map应用,也可用trie 2.总结:一开始直接用数组遍历,果断T了一发 题意:t个数,奇变1,偶变0,然后与问的 ...

  7. CF #365 (Div. 2) D - Mishka and Interesting sum 离线树状数组

    题目链接:CF #365 (Div. 2) D - Mishka and Interesting sum 题意:给出n个数和m个询问,(1 ≤ n, m ≤ 1 000 000) ,问在每个区间里所有 ...

  8. CF #365 (Div. 2) D - Mishka and Interesting sum 离线树状数组(转)

    转载自:http://www.cnblogs.com/icode-girl/p/5744409.html 题目链接:CF #365 (Div. 2) D - Mishka and Interestin ...

  9. CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table

    二分!!! AC代码例如以下: #include<iostream> #include<cstring> #include<cstdio> #define ll l ...

随机推荐

  1. 设计模式之责任链模式(php实现)

    github地址:https://github.com/ZQCard/design_pattern /** * 责任链模式(Chain of Responsibility Pattern)为请求创建了 ...

  2. 6、Python模块

    最常用的两个模块: os    #可以允许python调用执行系统命令,如shell sys    #处理与python程序本身的事情   Python自带200多个常用模块 Python官网收集了2 ...

  3. Spark Streaming与Storm的对比及使用场景

    Spark Streaming与Storm都可以做实时计算,那么在做技术选型的时候到底应该选择哪个呢?通过下图可以从计算模型.计算延迟.吞吐量.事物.容错性.动态并行度等方方面进行对比. 对比点    ...

  4. SpringMVC处理MYSQL BLOB字段的上传

    任务: uos.docfile的content字段是longblob类型的,通过页面将文件存储到这个字段里. 页面代码: <div class="box"> <d ...

  5. native method与so中function的关联

    在Android中,可以通过JNI的方式来调用和访问用C/C++实现的代码,这些代码以SharedLibrary的方式存在于so中.从Java Code到Native Code的一般使用过程为: 在J ...

  6. 福利来了,全国路网数据,poi数据

    本人现有全国路网数据,POI数据,均为原始数据.无偏移,都已分类,如图所示.有意请联系(QQ204843224), 兴趣点包含: 餐饮.村庄.大厦.服务区.公安交警.购物.火车站.机场.加油站.交通. ...

  7. BZOJ 4216 Pig 分块乱搞

    题意:id=4216">链接 方法:分块以节约空间. 解析: 这题坑的地方就是他仅仅有3M的内存限制,假设我们开longlong前缀和是必死的. 所以考虑缩小这个long long数组 ...

  8. 【VBA】修改Excle的标题

    打开Excle的时候,有时候不需要显示Miscrosoft Excle,如下图标记,想把标记内的内容替换为:管理系统 操作代码: Public Sub 修改标题() Application.Capti ...

  9. DICOM医学图像处理:WEB PACS初谈二,图像的传输

    背景: 如前一篇专栏博文所述,借助于CGI或FastCGI技术转发浏览器发送过来的用户请求,启动本地的DCMTK和CxImage库响应.然后将处理结果转换成常规图像返回到浏览器来实现Web PACS. ...

  10. 关于Android项目中的分层,参考eoecn开源项目(8.29)

    以下为eoecn开源项目的分层情况: ├ cn.eoe.app --存放程序全局性类的包├ cn.eoe.app.adapter --存放适配器的实现类的包 ├ cn.eoe.app.adapter. ...