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. POJ1291-并查集/dfs

    并查集 题意:找出给定的这些话中是否有冲突.若没有则最多有多少句是对的. /* 思路:如果第x句说y是对的,则x,y必定是一起的,x+n,y+n是一起的:反之x,y+n//y,x+n是一起的. 利用并 ...

  2. jQuery遍历函数

    jQuery遍历函数包含了用于筛选.查找和串联元素的方法. .add():将元素加入到匹配元素的集合中. .andSelf():把堆栈中之前的元素集加入到当前集合中. .children():获得匹配 ...

  3. Java经典23种设计模式之创造型模式(一)

    设计模式被称为程序猿的内功,之前零零散散的看过一大部分,但自己么有总结过.故此次在这里总结下.值得一提的是,设计模式并不是Java所特有.由于一直搞Android.这里就用Java为载体.最经典的设计 ...

  4. Urxvt - awesome

    Urxvt - awesome Urxvt From awesome Jump to: navigation, search rxvt-unicode (urxvt for short) is a c ...

  5. JAVA线程相互排斥问题

    public class TraditionalThreadSynchonized { public static void main(String[] args) { final OutPuter ...

  6. 关于JAVA Project.waitfor()返回值是1

    Project.waitfor()返回值是1,找了很久从网上没有发现关于1的说明. 这时对源代码调试了一下,发现Project=null.而去根目录下点击被调用的bat文件发现也可以被正确执行. 这时 ...

  7. The tempfile module

    The tempfile module The tempfile module This module allows you to quickly come up with unique names ...

  8. POJ 3267-The Cow Lexicon(DP)

    The Cow Lexicon Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8252   Accepted: 3888 D ...

  9. pygtk手记(1)

    GTK+使用C语言开发,但是其设计者使用面向对象技术. 也提供了C++(gtkmm).Perl.Ruby.Java和Python(PyGTK)绑定,其他的绑定有Ada.D.Haskell.PHP和所有 ...

  10. 读懂Java中的Socket编程(转)

    Socket,又称为套接字,Socket是计算机网络通信的基本的技术之一.如今大多数基于网络的软件,如浏览器,即时通讯工具甚至是P2P下载都是基于Socket实现的.本文会介绍一下基于TCP/IP的S ...