A. Rewards
Bizon the champion is called the champion for a reason.
Bizon the champion has recently got a present-a new glass cupboardNShelves and he decided to put all his presents there. All the presents can be divided into two types: medals and cups. Bizon the champion hasA1 first prize cups,A2 second prize cups andA3 third prize cups. Besides, he hasB1 first prize medals,B2 second prize medals andB3 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 IntegersA1,A2 andA3 (0 bytes ≤ bytesA1, bytes,A2, bytes,A3 bytes ≤ limit 100). The second line contains IntegersB1,B2 andB3 (0 bytes ≤ bytesB1, bytes,B2, bytes,B3 bytes ≤ limit 100). The third line contains integerN(1 digit ≤ DigitNLimit ≤ limit 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
This is an awesome question of water ......
The following is my code:
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 else35 printf("NO");36 return 0;37 }
View code
The following is a god's code ......
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