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

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

题意:一种是奖杯一种是奖牌放架子上,一层能放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的更多相关文章

  1. Codeforces Round #256 (Div. 2) 题解

    Problem A: A. Rewards time limit per test 1 second memory limit per test 256 megabytes input standar ...

  2. Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)

    转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...

  3. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)

    解题报告 意思就是说有n行柜子,放奖杯和奖牌.要求每行柜子要么全是奖杯要么全是奖牌,并且奖杯每行最多5个,奖牌最多10个. 直接把奖杯奖牌各自累加,分别出5和10,向上取整和N比較 #include ...

  4. Codeforces Round #256 (Div. 2) B. Suffix Structures(模拟)

    题目链接:http://codeforces.com/contest/448/problem/B --------------------------------------------------- ...

  5. Codeforces Round #256 (Div. 2)

    A - Rewards 水题,把a累加,然后向上取整(double)a/5,把b累加,然后向上取整(double)b/10,然后判断a+b是不是大于n即可 #include <iostream& ...

  6. Codeforces Round #256 (Div. 2/B)/Codeforces448B_Suffix Structures(字符串处理)

    解题报告 四种情况相应以下四组数据. 给两字符串,推断第一个字符串是怎么变到第二个字符串. automaton 去掉随意字符后成功转换 array 改变随意两字符后成功转换 再者是两个都有和两个都没有 ...

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

  8. Codeforces Round #256 (Div. 2) D. Multiplication Table

    主题链接:http://codeforces.com/contest/448/problem/D 思路:用二分法 code: #include<cstdio> #include<cm ...

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

随机推荐

  1. [ACM] hdu 4405 Aeroplane chess (概率DP)

    Aeroplane chess Problem Description Hzz loves aeroplane chess very much. The chess map contains N+1 ...

  2. SLIC superpixel实现分析

    http://infoscience.epfl.ch/record/149300这是SLIC算法的官网,网站有和SLIC相关的资源. SLIC主要运用K-means聚类算法进行超像素的处理,聚类算法中 ...

  3. [Android阅读代码]圆形旋转菜单CircleMenu

    项目名称:圆形旋转菜单CircleMenu 原版项目代码下载 感谢原作者开源

  4. php使用http请求头实现文件下载

    众所周知php对http协议的依赖特别强,像java或者asp.net在某些情况下可以不依赖http例如asp.net的winform,对php来说文件下载可以使用http的请求头加上php的IO就可 ...

  5. 使用ROW_NUMBER()查询:列名 'RowNumber' 无效。

    原文:使用ROW_NUMBER()查询:列名 'RowNumber' 无效. 使用ROW_NUMBER()方法查询结果集:语句如下:   select ROW_NUMBER() OVER(ORDER ...

  6. hdu1896之优先队列应用

    Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Sub ...

  7. Java注解全面解析(转)

    1.基本语法 注解定义看起来很像接口的定义.事实上,与其他任何接口一样,注解也将会编译成class文件. @Target(ElementType.Method) @Retention(Retentio ...

  8. hdu1069(dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 分析: 每种石头有六种方法,那么等效为:有6*n种石头. 根据x和y排序(要保证相应的x.y总有 ...

  9. Linux下玩转Dota2

    Dota2是一款颇为风靡的即时战略类游戏,去年官方就支持Mac和Linux了,对于习惯Mac和linux平台的孩子们来说,简直感动的泪流满面. 当然,也简直是linux程序猿的福音啊啊! 与Win8. ...

  10. MyBatis一级缓存引起的无穷递归

    MyBatis一级缓存引起的无穷递归 引言: 最近在项目中参与了一个领取优惠劵的活动,当多个用户领取同一张优惠劵的时候,使用了数据库锁控制并发,起初的设想是:如果多个人同时领一张劵,第一个到达的人领取 ...