CodeForces - 151A Soft Drinking (数学水题)
来源:互联网 发布:单片机晶振 编辑:程序博客网 时间:2024/06/05 11:36
Description
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 n, k, l, c, d, p, nl, np, 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 Input
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
Hint
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 = 80 toasts 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.
#include<stdio.h>#include<math.h>#include<string.h>#include<algorithm>#define INF 0x3f3f3f3f#define ll long long#define N 10010using namespace std;int main(){int n,k,l,c,d,p,nl,np;while(scanf("%d%d%d%d%d%d%d%d",&n,&k,&l,&c,&d,&p,&nl,&np)!=EOF){int kk=(k*l)/nl;int cc=c*d;int pp=p/np;int mm=INF;mm=min(mm,(int)kk/n);mm=min(mm,(int)cc/n);mm=min(mm,(int)pp/n);printf("%d\n",mm);}return 0;}
- CodeForces - 151A Soft Drinking (数学水题)
- CodeForces 151A - Soft Drinking
- Codeforces 151A Soft Drinking 【水题】
- A. Soft Drinking
- Codeforces Round #107 (Div. 2)---A. Soft Drinking
- Soft Drinking
- codeforces 50A Domino piling(数学水题)
- Codeforces 478A Initial Bet(数学水题)
- Codeforces--660A--Co-prime Array(数学水题)
- (数学水题)Codeforces A. Kirill And The Game
- codeforces 4A Watermelon(数学水题)
- codeforces 789A(数学)
- Codeforces-----140A---New Year Table---数学水题
- Codeforces-----614A---Link/Cut Tree---数学水题
- CodeForces--621A--Wet Shark and Odd and Even(数学水题)
- Codeforces 650A 数学简单题
- CodeForces 453A(数学期望)
- Educational Codeforces Round 7(A)数学
- angularjs前端框架
- Python图像处理库PIL的ImageSequence模块介绍
- 首篇
- 7.数据对象映射模式
- Linux 网络编程 套接字结构
- CodeForces - 151A Soft Drinking (数学水题)
- 从输入URL到页面加载完成的过程中都发生了什么事情?
- 问题 K: 序列的区间操作
- linux下查看和添加PATH环境变量
- web.xml中在Servlet中获取context-param和init-param内的参数
- 几种基本排序的java实现
- hdu 5635 LCP Array
- Xcode中的文件结构
- LINUX之----启程(centos 6.5)