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 ...
随机推荐
- word如何修改尾注
两篇处理利用尾注处理参考文献的方式,值得注意. 实用技巧:Word 2003中修改尾注位置http://www.kuqin.com/shuoit/20090422/47316.html Word尾注格 ...
- hibernate的 lazy 和 fetch 一般配置
fetch 和 lazy 配置用于数据的查询 lazy 参数值常见有 false 和 true,Hibernate3 映射文件中默认lazy = true : fetch 指定了关联对象抓取的方式,参 ...
- 用word2vec对语料进行训练
在Linux上安装好word2vec, 进入trunk文件夹,把分词后的语料文件放在trunk文件夹内,执行:./word2vec -train tt.txt -output vectors.bin ...
- 修改PHP上传文件的大小限制(post)
在PHP的默认配置情况下,当上传的文件大小超出一定的限制时,我们将得到如下的错误提示信息: Warning: POST Content-Length of 625523488 bytes exceed ...
- 系统封装 EasyBoot如何将WIN7安装版提取到光盘
1 将WIN7光盘中的文件提取到Easyboot根目录,注意不要autorun.inf和setup.exe这两个文件.我们这里的Easyboot已经有了一些其他东西(XP的安装版文件,PE的文件等等, ...
- react-native 详解
1.获取主屏幕尺寸 // 导入类库 var Dimensions = require('Dimensions'); // 样式 const styles = StyleSheet.create({ c ...
- BaseAdapter的使用(笔记)
适配器模式的应用: 1.减少程序耦合性 2.easy扩展 BaseAdapter ListView的显示与缓存机制:须要才显示,显示完就被会受到缓存. BaseAdapter基本结构 --public ...
- NYOJ 257 郁闷的C小加(一)
郁闷的C小加(一) 时间限制:1000 ms | 内存限制:65535 KB 难度: 描写叙述 我们熟悉的表达式如a+b.a+b*(c+d)等都属于中缀表达式.中缀表达式就是(对于双目运算符来说) ...
- spring 源码下载
github spring 源码 导入Spring源码方法 java世界中的三大构建工具:ant,maven,gradle gradle 简介
- java中按字节获得字符串长度的两种方法 Java问题通用解决代码
jdk本身就自带获取字符串字节长度的api了,但字符串如果包含特殊符号或全半角符号或标点符号获取到的结果会有偏差,最好的证据就是新浪微博的字数统计了 // jdk自带的获取字节长度 //注意getBy ...