CF#256(Div.2) A. Rewards
1 second
256 megabytes
standard input
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.
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.
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).
1 1 1
1 1 1
4
YES
1 1 3
2 3 4
2
YES
1 0 0
1 0 0
1
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的更多相关文章
- 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 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- CF #374 (Div. 2) D. 贪心,优先队列或set
1.CF #374 (Div. 2) D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...
- CF #374 (Div. 2) C. Journey dp
1.CF #374 (Div. 2) C. Journey 2.总结:好题,这一道题,WA,MLE,TLE,RE,各种姿势都来了一遍.. 3.题意:有向无环图,找出第1个点到第n个点的一条路径 ...
- CF #371 (Div. 2) C、map标记
1.CF #371 (Div. 2) C. Sonya and Queries map应用,也可用trie 2.总结:一开始直接用数组遍历,果断T了一发 题意:t个数,奇变1,偶变0,然后与问的 ...
- 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) ,问在每个区间里所有 ...
- 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 ...
- CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table
二分!!! AC代码例如以下: #include<iostream> #include<cstring> #include<cstdio> #define ll l ...
随机推荐
- 设计模式之过滤器模式(php实现)
/** * github地址:https://github.com/ZQCard/design_pattern * 过滤器模式(Filter Pattern)或标准模式(Criteria Patter ...
- 控制面板里找不到“应用程序server”这个项目,Windows XP中金蝶安装时无“应用程序server”的解决的方法
要注意先安装IIS,再安装VS2008. 我们会常常在控制面板里找不到"应用程序server"这个项目.我们须要依照以下的步骤来操作就会Ok. 1.下载IIS6,放置到D盘根文件夹 ...
- Maven配置Spring+Hibernate Shiro权限控制项目
前言:在Eclipse中安装好Maven插件,然后创建一个Sample项目.在Eclipse中检出Shiro的官方演示样例.地址http://svn.apache.org/repos/asf/shir ...
- vertex buffer 数据结构 如何读vb的memory pool
vertex attribute (declaration) vertex stream (memory pool) 这两部分 通过attribute 里面对memory的描述把两部分 vbo ...
- 【Hadoop】Hadoop MR 如何实现倒排索引算法?
1.概念.方案 2.代码示例 InverseIndexOne package com.ares.hadoop.mr.inverseindex; import java.io.IOException; ...
- RedHat虚拟机相关操作
在VM虚拟机中安装完Redhat系统之后 如果需要用secureCRT连接linux系统的话 操作步骤如下: 1.进入linux系统,在终端输入ifconfig(注意,不是windows的ipconf ...
- eclipse自动添加作者、日期等注释
使用eclipse的时候一般会添加自己的注释,标注日期作者等内容,我总结的添加注释的方式有两种:一.在新建class时自动添加注释:二.通过快捷键自动添加注释.下面分别描述一下添加方式. 一.新建cl ...
- react-native 常用组件的用法(二)
ScrollView组件 能够调用移动平台的ScrollView(滚动视图)的组件,同时还集成了触摸锁定的“响应者”系统.注意一定要给scrollview一个高度,或者是他父级的高度. 常用方法 on ...
- 正则表达式Pattern ,Matcher
正则表达式:符合一定规则的表达式 作用:用于专门操作字符串 特点:用于一些特定的符号来表示一些代码的操作,这样就简化代码的书写 学习正则表达式就是要学习一些特殊符号的使用 好处:简化对字符串复杂的操作 ...
- java读取clob字段的几种方法
http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece7631046893b4c4380143fd3d1027fa3c215cc790f1a06 ...