codeforces-448A-Rewards

简介:
Rewards
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard 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




第一次在codeforces上做的题
//取余问题,大水题

AC代码:

#include<stdio.h>
#include<string.h>
int main()
{
    int x,y,z,k,a,b,c,m;
    char s[5];
    scanf("%d%d%d",&x,&y,&z);
    scanf("%d%d%d",&a,&b,&c);
    scanf("%d",&k);
    ((x+y+z+4)/5+(a+b+c+9)/10)>k?m=1:m=2;
    if(m==2)
      printf("YES\n");
    else
      printf("NO\n");
    return 0;
}

相关文章
codeforces 322 B Ciel and Flowers
有红绿蓝三种颜色的画,每种拿三朵可以组成一束花,或者各拿一朵组成花束,告诉你每种花的数目,求出可能组成最多的花束。 如果你的代码过不了,考虑一下 8 8 9这种组合。 因为数据量很大,我的思想就是局部和总体采用不同的策略。
47 0
codeforces 312
A. Whose sentence is it?
47 0
codeforces 322 A Ciel and Dancing
有n个男孩和m个女孩,他们要结对跳舞,每对要有一个女孩和一个男孩,而且其中一个要求之前没有和其他人结对,求出最大可以结多少对。
35 0
codeforces 304A. Pythagorean Theorem II
给你一个n,计算出1 ≤ a ≤ b ≤ c ≤ n.使得由abc构成的三角形满足勾股定理,c为斜边。 没有简单的方法,直接爆力,但是要注意,有些abc满足勾股定理的表达式,但不一定是三角形,所以要判断一下,根据三角形三边的性质,两边之和大于第三边,两边之差小于第三边。
58 0
codeforces 327 A Ciel and Dancing
给你一串只有0和1的数字,然后对某一区间的数翻转1次(0变1 1变0),只翻转一次而且不能不翻转,然后让你计算最多可能出现多少个1。 这里要注意很多细节 比如全为1,要求必须翻转,这时候我们只要翻转一个1就可以了,对于其他情况,我们只要计算区间里面如果0多于1,将其翻转后计算1的总数,然后取最大值。
40 0
C - Rumor CodeForces - 893C
C - Rumor CodeForces - 893C
87 0
|
人工智能
Codeforces 777C Alyona and Spreadsheet
C. Alyona and Spreadsheet time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard ...
1156 0
Codeforces 591B Rebranding
B. Rebranding time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output ...
853 0
|
人工智能
Codeforces 719B Anatoly and Cockroaches
B. Anatoly and Cockroaches time limit per test:1 second memory limit per test:256 megabytes input:standard input output:stan...
890 0