Codeforces Round #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
a3 third 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
题意:一种是奖杯一种是奖牌放架子上,一层能放5个奖杯,或者10个奖牌,一层不能有两种,水题。
AC代码:
import java.util.*;
public class Main { public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int a1=scan.nextInt(),a2=scan.nextInt(),a3=scan.nextInt();
int b1=scan.nextInt(),b2=scan.nextInt(),b3=scan.nextInt();
int n=scan.nextInt();
int sum1,sum2;
sum1=a1+a2+a3;
sum2=b1+b2+b3;
int count=0;
if(sum1%5==0){
count+=sum1/5;
}
else
count+=sum1/5+1;
if(sum2%10==0){
count+=sum2/10;
}
else
count+=sum2/10+1;
if(count>n)
System.out.println("NO");
else
System.out.println("YES");
} }
Codeforces Round #256 (Div. 2) A. Rewards的更多相关文章
- Codeforces Round #256 (Div. 2) 题解
Problem A: A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)
转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...
- Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)
解题报告 意思就是说有n行柜子,放奖杯和奖牌.要求每行柜子要么全是奖杯要么全是奖牌,并且奖杯每行最多5个,奖牌最多10个. 直接把奖杯奖牌各自累加,分别出5和10,向上取整和N比較 #include ...
- Codeforces Round #256 (Div. 2) B. Suffix Structures(模拟)
题目链接:http://codeforces.com/contest/448/problem/B --------------------------------------------------- ...
- Codeforces Round #256 (Div. 2)
A - Rewards 水题,把a累加,然后向上取整(double)a/5,把b累加,然后向上取整(double)b/10,然后判断a+b是不是大于n即可 #include <iostream& ...
- Codeforces Round #256 (Div. 2/B)/Codeforces448B_Suffix Structures(字符串处理)
解题报告 四种情况相应以下四组数据. 给两字符串,推断第一个字符串是怎么变到第二个字符串. automaton 去掉随意字符后成功转换 array 改变随意两字符后成功转换 再者是两个都有和两个都没有 ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table 二分法
D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input st ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table
主题链接:http://codeforces.com/contest/448/problem/D 思路:用二分法 code: #include<cstdio> #include<cm ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table 很有想法的一个二分
D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input stand ...
随机推荐
- Kali Linux 装好系统后安装经常使用软件
1.配置软件源 leafpad /etc/apt/source.list or(recommand): #官方源 deb http://http.kali.org/kali kali main no ...
- Wamp 访问本地站点慢 的解决办法
自从安装了64位的windows 8.1之后,电脑运行速度变快了,可是重新下载安装64位的WAMP,访问本地的WEB站点确是很慢,根本不像是在本地访问,经过在WAMP论坛上搜索,终于找到了解决办法,主 ...
- 201215-03-19---cocos2dx内存管理--具体解释
因为cocos2dx我们的使用c++写的,所以内存管理就是一个绕只是去的坎,这个你不懂内存仅仅懂业务逻辑的话,还玩什么c++,今天看了半天这个东西,事实上本质上是理解的,可是就是有一个过不去的坎,最终 ...
- [Python]网络爬虫(十):一个爬虫的诞生全过程(以山东大学绩点运算为例)
先来说一下我们学校的网站: http://jwxt.sdu.edu.cn:7777/zhxt_bks/zhxt_bks.html 查询成绩需要登录,然后显示各学科成绩,但是只显示成绩而没有绩点,也就是 ...
- Shell简易学习练习
1.Linux Shell入门 Quiz 1 一个接受命令行参数的shell脚本 任务 编写一个shell脚本1.sh,这个脚本接受一个命令行参数,并把这个参数打印两次到标准输出. 如果输入没有参数输 ...
- hdu2159(二维完全背包)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2159 题意:打怪,还有最后一级,忍耐度有限m,问在杀怪数量上限为s的情况下能否获取n经验而通关,且忍耐 ...
- SQL SERVER中的流程控制语句
流程控制语句 是指用来控制程序运行和流程分至点额命令.一般指的是逻辑计算部分的控制. 1.Begin End语句 封装了多个T-SQL语句组合,将他们组成一个单元来处理. 一般在条件查询或者循环等控制 ...
- [置顶] ※数据结构※→☆线性表结构(list)☆============双向链表结构(list double)(三)
双向链表也叫双链表,是链表的一种,它的每个数据结点中都有两个指针,分别指向直接后继和直接前驱.所以,从双向链表中的任意一个结点开始,都可以很方便地访问它的前驱结点和后继结点. ~~~~~~~~~~~~ ...
- 基于FFMPEG和SDL实现视频播放器
这个是雷大牛实现的project. http://download.csdn.net/detail/leixiaohua1020/5122959 有兴趣的能够好好研究研究.
- 158个JAVA免豆精品资料汇总
附件完整版下载地址: http://down.51cto.com/data/431561 附件部分预览~ java中国移动收费系统[源代码] http://down.51cto.com/data/70 ...