zoukankan      html  css  js  c++  java
  • Codeforces Round #256 (Div. 2) A Rewards

    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

    这是一道水的一逼的水题……
    以下是我的代码:
     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

    下面是某神的代码……

    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
  • 相关阅读:
    Vue 中使用 viewerjs
    PS 给照片换背景
    HTML学习-1网页基础知识
    git使用
    Java读取XML配置文件
    Java是如何读到hbase-site.xml 的内容的
    HBASE count方法总结
    Getting Started with Java Development on Docker
    持续集成案例学习:Docker、Java与Maven
    利用MAVEN打包时,如何包含更多的资源文件
  • 原文地址:https://www.cnblogs.com/qscqesze/p/3852497.html
Copyright © 2011-2022 走看看