解题报告
意思就是说有n行柜子,放奖杯和奖牌。要求每行柜子要么全是奖杯要么全是奖牌,并且奖杯每行最多5个,奖牌最多10个。
直接把奖杯奖牌各自累加,分别出5和10,向上取整和N比較
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
using namespace std; int main()
{
double a[10],b[10],suma=0,sumb=0;
int n,i,j;
for(i=0; i<3; i++)
{
cin>>a[i];
suma+=a[i];
}
for(i=0; i<3; i++)
{
cin>>b[i];
sumb+=b[i];
}
cin>>n;
suma=ceil(suma/5);
sumb=ceil(sumb/10);
if(suma+sumb>n)
cout<<"NO"<<endl;
else cout<<"YES"<<endl;
return 0;
}

Rewards
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 a3third
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

Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)的更多相关文章

  1. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  2. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  3. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  4. Codeforces Round #190 (Div. 2) 水果俩水题

    后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...

  5. Codeforces Round #282 (Div. 1) A. Treasure 水题

    A. Treasure Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/494/problem/A ...

  6. Codeforces Round #327 (Div. 2) B. Rebranding 水题

    B. Rebranding Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem ...

  7. Codeforces Round #194 (Div. 1) B. Chips 水题

    B. Chips Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/333/problem/B D ...

  8. Codeforces Round #377 (Div. 2) C. Sanatorium 水题

    C. Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  9. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

随机推荐

  1. Python复数属性和方法操作实例

    转自: https://blog.csdn.net/henni_719/article/details/56665254 #coding=utf8 ''' 复数是由一个实数和一个虚数组合构成,表示为: ...

  2. Mysql的学习随笔day2

    关于输入中文的问题,各种更改完utf8后仍然乱码. 最后找到一种可行的方法:在insert之前,输入 set names 'gbk' 约束保证数据的完整性和一致性.约束分为表级约束和列级约束,前者可以 ...

  3. Oil Deposits 搜索 bfs 强联通

    Description The GeoSurvComp geologic survey company is responsible for detecting underground oil dep ...

  4. Hibernate与MyBatis的对比总结

    最近做了一个Hibernate与MyBatis的对比总结,希望大家指出不对之处. 第一章     Hibernate与MyBatis Hibernate 是当前最流行的O/R mapping框架,它出 ...

  5. 重温PHP之插入排序

    插入排序基本思路:将数组分为两个区(已排序区和未排序区),假定数组的第一个元素处于已排序区, 第一个元素之后的所有元素都处于未排序部分.排序时用到双层循环,外层循环用于从未排序部分中取出待排序元素,并 ...

  6. QN-H618 遥控器复制再生仪(拷贝机)

    针对现在市场上日益更新的遥控器种类,本公司经过长时间的研究,推出新一代拷贝机,本产品有以下特点: 1. 众多车库门遥控分析信息被集成在一台机器内,只要一种遥控器,就可以复制众多品牌的车库遥控.免去积压 ...

  7. oracle systemtap tracing

    https://github.com/LucaCanali?tab=repositories https://github.com/LucaCanali/Linux_tracing_scripts/t ...

  8. mysql内核 innodb存储引警(卷1)配书 用VS 2003 编绎 mysql-3.23.49 源代码

    作者网址:http://www.innomysql.net/ 1.旧版 mysql-3.23.49-win-src.zip 下载 (***络下载配书源代码)   或者  作者网盘  http://pa ...

  9. 【Nginx】ngx_event_core_module模块

    ngx_event_core_module模块属于事件模块,它是其他事件类模块的基础.它主要完毕下面任务: 创建连接池 决定使用哪些事件驱动机制 初始化将要使用的事件模块 以下分析该模块的代码. ng ...

  10. 为DropDownListFor设置选中项

    在MVC中,当涉及到强类型编辑页,如果有select元素,需要根据当前Model的某个属性值,让Select的某项选中.本篇只整理思路,不涉及完整代码. □ 思路 往前台视图传的类型是List< ...