Codeforces #256 A. Rewards,
A. Rewardstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
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 11 1 14
Output
YES
Input
1 1 32 3 42
Output
YES
Input
1 0 01 0 01
Output
NO questions are not explained#include <iostream>using namespace std;int main(){ int n,a1,a2,a3,b1,b2,b3; cin>>a1>>a2>>a3>>b1>>b2>>b3>>n; if(n>=(a1+a2+a3+4)/5+(b1+b2+b3+9)/10) cout<<"YES";else cout<<"NO"; }
Codeforces question: How can I attack others in codeforces?
For a question, you must first pass TEST. Then return to the PROBLEM list of the game, lock the lock behind the question (the lock won't be submitted again, so don't lock it if you're unsure), and then go to the ROOM, you can check other people's Code. There is a HACK button below. Click it and enter the example that you think is wrong.
How can codeforces view the test data after the competition ends?
Click standing and double-click the person passing through the standing. The AC is the AC code.