码迷,mamicode.com
首页 > 其他好文 > 详细

Codeforces Round #256 (Div. 2) A Rewards

时间:2014-07-18 10:17:51      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   os   

A. Rewards

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

这是一道水的一逼的水题……
以下是我的代码:
bubuko.com,布布扣
 1 #include<iostream>  
 2 #include<string.h>  
 3 #include<stdio.h>  
 4 #include<ctype.h>  
 5 #include<algorithm>  
 6 #include<stack>  
 7 #include<queue>  
 8 #include<set>  
 9 #include<math.h>  
10 #include<vector>  
11 #include<map>  
12 #include<deque>  
13 #include<list>  
14 using namespace std; 
15 int main()
16 {
17     int a,b,c,d,e,f,g;
18     cin>>a>>b>>c>>d>>e>>f>>g;
19     int s=a+b+c;
20     int m=0;
21     while(s>0)
22     {
23         s=s-5;
24         m=m+1;
25     }
26     int n=0,s2=d+e+f;
27     while(s2>0)
28     {
29         s2=s2-10;
30         n=n+1;
31     }
32     if(g>=m+n)
33     printf("YES");
34     else
35     printf("NO");
36     return 0;
37 } 
View Code

下面是某神的代码……

bubuko.com,布布扣
1 #include <iostream>
2 using namespace std;
3 
4 int main() {
5     int a, b, c, d, e, f, g;
6     cin >> a >> b >> c >> d >> e >> f >> g;
7     cout << ((a + b + c + 4) / 5 + (f + d + e + 9) / 10 <= g ? "YES" : "NO");
8     return 0;
9 }
View Code

Codeforces Round #256 (Div. 2) A Rewards,布布扣,bubuko.com

Codeforces Round #256 (Div. 2) A Rewards

标签:des   style   blog   http   color   os   

原文地址:http://www.cnblogs.com/qscqesze/p/3852497.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!