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. 大话设计模式C++达到-文章12章-外观模式

    一.UML画画 关键词:添加Facade层. 二.概念 外观模式:为子系统中的一组接口提供一个一致的界面.此模式定义了一个高层接口,这个接口使得这一子系统更加easy使用. 三.说明 Q:外观模式在什 ...

  2. Ajax—初识

    看DRP的过程.又一次学习了一遍Ajax.更深刻的体会到了Ajax所具有的魅力.Ajax是一种技术或者方法,更是一 种艺术.它让我们的程序以一种更完美的姿态呈如今用户面前.以下就让我们一起走进Ajax ...

  3. JS上传图片本地实时预览缩略图

    HTML 代码如下 <body> <table width="100%" border="0" cellspacing="0&quo ...

  4. 新浪微博。。openapi 分享 图画+ 写作

    新浪微博困难啊 .. . .. .郁闷死了. .在此记录它 1.使用界面:https://api.weibo.com/2/statuses/upload_url_text.json 能够申请,.高级权 ...

  5. 构建自己的Java并发模型框架

    Java的多线程特性为构建高性能的应用提供了极大的方便,可是也带来了不少的麻烦.线程间同步.数据一致性等烦琐的问题须要细心的考虑,一不小心就会出现一些微妙的,难以调试的错误. 另外.应用逻辑和线程逻辑 ...

  6. OPENVPN开启用户password认证

    一.服务端配置 1.改动openvpn的主配置文件,加入例如以下内容 [root@ttt openvpn]# cat /etc/openvpn/server.conf |more #########a ...

  7. 《Linux内核设计与实现》的地址空间读书笔记的过程

    1.核心区域进程包括各种内存对象 种内存对象,比方: 1.可运行文件代码能够包括各种内存映射,称为代码段(text section). 2.可运行文件的已初始化全局变量的内存映射,称为数据段(data ...

  8. 使用C#和.NET 4编写的并行应用程序“多核并发编程的规则”

    “多核并发编程的规则” 规则的描述如下 1.      并发编程的思想—这条规则就是要谨记并发编程思想进行设计,就像前边章节所提交的. 2.      面向抽象编程-你可以利用.NET4中的TPL提供 ...

  9. 【程序猿助手】Emacs,最强的编辑器,之间的不

     wx_fmt=png" alt="" style="max-width:100%; height:auto!important"> 内容简单 ...

  10. ubuntu 安装输入法(fcitx)

    目前搜狗输入法是基于fcitx框架下的,所以我们得安装fcitx才行 首要得卸载Ubuntu默认的ibus输入法:sudo apt-get remove ibus 然后添加fcitx的nightlyP ...