Codeforces #256 A. Rewards,

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.