time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

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?

Input

The first and only line contains positive integers nklcdpnlnp,
not exceeding 1000 and no less than 1. The numbers are separated by
exactly one space.

Output

Print a single integer — the number of toasts each friend can make.

Sample test(s)
input
3 4 5 10 8 100 3 1
output
2
input
5 100 10 1 19 90 4 3
output
3
input
10 1000 1000 25 23 1 50 1
output
0
Note

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的更多相关文章

  1. 构造 Codeforces Round #107 (Div. 2) B. Phone Numbers

    题目传送门 /* 构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:( */ #include <cstdio> #include <algorithm> ...

  2. Codeforces Round #107 (Div. 1) B. Quantity of Strings(推算)

    http://codeforces.com/problemset/problem/150/B 题意: 给出n,m,k,n表示字符串的长度为n,m表示字符种类个数,k表示每k个数都必须是回文串,求满足要 ...

  3. Codeforces Round #107 (Div. 2)

    D题 并查集+组合 #include <iostream> #include <cstdio> #include <cstring> using namespace ...

  4. Codeforces Round #271 (Div. 2)题解【ABCDEF】

    Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 ...

  5. Codeforces Round #272 (Div. 2) 题解

    Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs time limit per test 1 second memory limit per ...

  6. 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 ...

  7. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  8. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  9. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

随机推荐

  1. Good Luck Charlie(听力恢复训练)

    系统的音标学习完毕后.在暑假进入了稍大强度的听力恢复训练.材料选择的是一部家庭情景喜剧片<Good Luck Charlie>,该剧是2010开播的.剧中运用到的大量词汇是和如今比較贴合的 ...

  2. SCSI miniport 驾驶一个简单的框架

    前段时间,只需用一台新电脑,由于资金有限没有匹配了心仪已久的SSD.我没感觉到飞翔的感觉,总不甘心,仔细想想.我死了相当大的存储,我们可以假设部分内存作为硬盘驱动器把它弄出来.不会比固态硬盘的速度快, ...

  3. XML解析中的namespace初探

    原文:XML解析中的namespace初探 初学者在解析XML文件的时候最容易遇到的问题恐怕就是XML的namespace了,本文旨在对namespace做一个简要的介绍. namespace的意义无 ...

  4. ecshop2.7.3怎么自动清除缓存

    1.在ecs_shop_config表中插入一条数据 进入ECSHOP后台-数据库管理-SQL查询 复制下面SQL,粘贴到里面执行.注意这时是默认表前缀ecs_,如果你的修改过要和你的统一了. INS ...

  5. ArrayList实现借壳

    随着Collections工具: import java.util.ArrayList; import java.util.Collections; public class TTEST { publ ...

  6. jQuery Ajax: $.post请求示例

    jQuery Ajax: $.post请求示例 leyangjun.html页面 <html> <head> <meta http-equiv="Content ...

  7. Android Google Map v2具体解释:开发环境配置

    Android Google Map v2具体解释:开发环境配置                                       --转载请注明出处:coder-pig 说在前面: 说到地 ...

  8. Win 10开门人类智慧的世界领先

    3月18日,从微软硬件project大会(WinHEC 2015)上传来好消息:今年夏天,Win 10将要正式公布.Win 10公布,有何新意? 微软新领导人纳德拉(Nadella)主张:运计算,大数 ...

  9. 【JUnit4.10来源分析】0导航

    JUnit靠GOF 中的一个Erich Gamma和 Kent Beck 单元测试框架编写一个开源,yqj2065分析JUnit的主要目的是源 中学习对设计模式的运用. JUnit也是一个学习Java ...

  10. javaweb学习总结(七)——HttpServletResponse对象(一)(转)

    Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象.和代表响应的response对象. request和response对象即然代表请求和响应,那我们 ...