Codeforces Round #107 (Div. 2)---A. Soft Drinking
2 seconds
256 megabytes
standard input
standard output
This winter is so cold in Nvodsk! A group of n friends decided to buy k bottles
of a soft drink called "Take-It-Light" to warm up a bit. Each bottle has l milliliters of the drink. Also they bought c limes
and cut each of them into d slices. After that they found p grams
of salt.
To make a toast, each friend needs nl milliliters of the drink, a slice of lime and np grams
of salt. The friends want to make as many toasts as they can, provided they all drink the same amount. How many toasts can each friend make?
The first and only line contains positive integers n, k, l, c, d, p, nl, np,
not exceeding 1000 and no less than 1. The numbers are separated by
exactly one space.
Print a single integer — the number of toasts each friend can make.
3 4 5 10 8 100 3 1
2
5 100 10 1 19 90 4 3
3
10 1000 1000 25 23 1 50 1
0
A comment to the first sample:
Overall the friends have 4 * 5 = 20 milliliters of the drink, it is enough to make 20 / 3 = 6 toasts.
The limes are enough for 10 * 8 = 80toasts and the salt is enough for 100 / 1 = 100 toasts.
However, there are 3 friends in the group, so the answer is min(6, 80, 100) / 3 = 2.
解题思路:贪心。只是是小学数学题。。
。算出三种成分的最大值,取当中的最小值就可以。
AC代码:
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std; int main(){
// freopen("in.txt", "r", stdin);
int n,k,l,c,d,p,nl,np;
while(cin>>n>>k>>l>>c>>d>>p>>nl>>np){
int a = (k * l) / nl;
int aa = p / np;
int aaa = c * d;
int ans = min(a, min(aa, aaa)) / n;
cout<<ans<<endl;
}
}
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Codeforces Round #107 (Div. 2)---A. Soft Drinking的更多相关文章
- 构造 Codeforces Round #107 (Div. 2) B. Phone Numbers
题目传送门 /* 构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:( */ #include <cstdio> #include <algorithm> ...
- Codeforces Round #107 (Div. 1) B. Quantity of Strings(推算)
http://codeforces.com/problemset/problem/150/B 题意: 给出n,m,k,n表示字符串的长度为n,m表示字符种类个数,k表示每k个数都必须是回文串,求满足要 ...
- Codeforces Round #107 (Div. 2)
D题 并查集+组合 #include <iostream> #include <cstdio> #include <cstring> using namespace ...
- Codeforces Round #271 (Div. 2)题解【ABCDEF】
Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 ...
- Codeforces Round #272 (Div. 2) 题解
Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs time limit per test 1 second memory limit per ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
随机推荐
- 批处理程序:自动上传FTP,再登陆linux服务器执行更新
----转载请注明出处:博客园-邦邦酱好 最近在学批处理程序,一直没找到能够结合工作来使用它的地方,前几天测试服务端的时候突然想到可以这样做: 写一个批处理程序,自动通过FTP上传软件包到指定的地方, ...
- CheckBoxList的操作查询是否被选中设置或者得到
在项目中我们可能会经常遇到一收集多选信息的情况,比如做注册的时候要收集个人爱好,那时候大家第一个想到的肯定是CheckBoxList.那我们怎么来获取到CheckBoxList的值并且存入数据库呢?? ...
- NYOJ 709(ZZULIOJ1481) 异 形 卵
题目描写叙述 我们探索宇宙,是想了解浩瀚星空的奥妙,但我们却非常少意识到宇宙深处藏匿的危急,它们无时无刻不紧盯着我们的地球.假设外星人拜訪我们,结果可能与哥伦布当年踏足美洲大陆不会有什么两样,这是历史 ...
- Linux日志清除
因为数据要求.经常需要抓住和筛选过滤数据,大概花了7 8个月.改变了机旁数据.重新开始,发现"No space left on device" 解决方法: 直接删除日志(简单粗暴) ...
- SICP的一些个人看法
网上搜书的时候,看到非常多人将这本书神话. 坦率地说,个人认为这本书过于学术化, 没什么实际project价值.一大堆题目也基本是高中数学竞赛题类似,浪费时间. 软件的核心技术是什么? 1> ...
- js+html+css简单的互动功能页面(2015知道几乎尖笔试题)http://v.youku.com/v_show/id_XMTI0ODQ5NTAyOA==.html?from=y1.7-1.2
js+html+css实现简单页面交互功能(2015知乎前端笔试题) http://v.youku.com/v_show/id_XMTI0ODQ5NTAyOA==.html? from=y1.7-1. ...
- 给Ubuntu安装KDE桌面 [转]
自ubuntu5.10发布以来,我非常难得的让她在我的硬盘上顽强生存了近3个月,仔细想想就连当年我第一个接触的红旗Linux也不过坚持了一个月,呵呵,又写了一段废话── 所 谓的“重回Kununtu” ...
- 【原创】leetCodeOj --- Find Minimum in Rotated Sorted Array II 解题报告
题目地址: https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ 题目内容: Suppose a sort ...
- 编译hibernate源代码
1)安装gradle,gradle是一个类似maven的构建工具 2)安装gitclient. 从网址 https://github.com/hibernate/hibernate-orm 上clon ...
- 左右presentViewController经background黑问题
看效果图: 用例如以下代码,想弹出一个模态窗体,设置它的背景透明度为0.5,却发觉prsent后的背景色变为黑色的. ShareVC *share = [[ShareVC alloc] init]; ...