Leyni, LOLI and Toasts

Leyni, LOLI and Toasts
Time Limit: 1000 MS Memory Limit: 65536 K
Total Submit: 47(37 users) Total Accepted: 37(37 users) Rating: Special Judge: No
Description

Leyni likes to play with LOLIs, but this winter is so cold in Harbin!

A group of n LOLIs decided to buy b bottles of soft drink to make themselves warmer. Each bottle has d milliliters of the drink. Also they bought l limes and cut each of them into k slices. After that they found p grams of salt.

To make a toast, each LOLI needs x milliliters of the drink, a slice of lime and y grams of salt. Having the average materials, the LOLIs want to make toasts as many as they can. How many toasts can each LOLI makes?

Input

There are multiple test cases. The first line of input is an integer T indicating the number of test cases. Then T test cases follow.

For each test case:

Line 1. This line contains eight positive integers, n, b, d, l, k, p, x, y (1 ≤ n, b, d, l, k, p, x, y ≤ 1000). The numbers are separated by exactly one space.

Output

For each test case:

Line 1. Output the number of toasts each LOLI can make.

Sample Input

1

3 4 5 10 8 100 3 1

Sample Output

2

Hint

In the sample, overall the LOLIs 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 LOLIs in the group, so the answer is 6 / 3 = 2.

Source
哈理工2012春季校赛 - 现场赛
Author
齐达拉图@HRBUST

#include<cstdio>
#include<cmath>
#include<queue>
#include<iostream>
using namespace std;
int min(int x,int y)
{
    return x<y? x:y;
}
int main()
{
    int  n, b, d, l, k, p, x, y;
    int T;
    while(~scanf("%d",&T))
    {
        while(T--)
        {
            scanf("%d%d%d%d%d%d%d%d",&n,&b,&d,&l,&k,&p,&x,&y);
        /*    if(n>b)
            {
                printf("0\n");
            }*/
            //else
        //    {
                int num1=b*d/(n*x);
                int num2=l*k/n;
                int num3=p/(y*n);
                printf("%d\n",min(num1,min(num2,num3)));
        //    }
        }
    }
    return 0;
}

时间: 2024-11-06 23:07:52

Leyni, LOLI and Toasts的相关文章

hlg1392Leyni, LOLI and Houses【网络流+二分+floyed】

今天过了几道网络流的题, 下面下一下解题报告, 题目难易不是梯度的 ,还有一些题目的代码在 voj上 等有空会补上的 Leyni, LOLI and Houses Time Limit: 2000 MS Memory Limit: 65536 K Total Submit: 43(12 users) Total Accepted: 19(11 users) Rating:  Special Judge: No Description Leyni likes to play with LOLIs.

哈理工 oj 1161 Leyni

Leyni Time Limit: 3000 MS Memory Limit: 65536 K Total Submit: 466(94 users) Total Accepted: 142(88 users) Rating: Special Judge: No Description Leyni被人掳走,身在水深火热之中... 小奈叶为了拯救Leyni,独自一人前往森林深处从静竹手中夺回昏迷中的Leyni. 历经千辛万苦,小奈叶救出了Leyni,但是静竹为此极为恼怒,决定对他们发起最强烈的进攻

【转】Android UI系列-----时间、日期、Toasts和进度条Dialog

原文网址:http://www.cnblogs.com/xiaoluo501395377/p/3421727.html 您可以通过点击 右下角 的按钮 来对文章内容作出评价, 也可以通过左下方的 关注按钮 来关注我的博客的最新动态. 如果文章内容对您有帮助, 不要忘记点击右下角的 推荐按钮 来支持一下哦 如果您对文章内容有任何疑问, 可以通过评论或发邮件的方式联系我: [email protected] / [email protected] 如果需要转载,请注明出处,谢谢!! 本篇随笔将继续学

android Toasts

1.基础 Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); 当然也可以将方法连起来而不是保持一个Toast对象: Toast.makeText(context, text,

hrbustoj 1161:Leyni(树状数组练习)

LeyniTime Limit: 3000 MS Memory Limit: 65536 KTotal Submit: 260(59 users) Total Accepted: 80(55 users) Rating: Special Judge: NoDescriptionLeyni被人掳走,身在水深火热之中...小奈叶为了拯救Leyni,独自一人前往森林深处从静竹手中夺回昏迷中的Leyni.历经千辛万苦,小奈叶救出了Leyni,但是静竹为此极为恼怒,决定对他们发起最强烈的进攻.不过小奈叶有

loli的测试——搜索

今天是2018.5.24,loli给我们说要考搜索,本来以为是给初学者们考的就没准备,然而老师说我们也要考. T1:N皇后问题 ...这个没什么好说的,真的就是普通的N皇后问题,输出方案(n<=10),本来想用位运算保存行和斜线,但是怕在简单题上写炸于是就写了很朴素的做法.   # include <cstdio> # include <iostream> # include <cstring> using namespace std; int n,A=0; bo

【题解】Leyni,罗莉和队列(树状数组)

[题解]Leyni,罗莉和队列(树状数组) HRBUST - 1356 将整个序列reverse一下,现在就变成了从高到低的排队.题目就变成了,定位一个妹子,问这个妹子前面的比这个妹子小的妹子中,下标最小的数是哪个. 所以以年龄为下标,以(原数组)下标为值建立一颗值域线段树,由于我们只要找到在原数组下标最小的哪一个,所以相当于动态维护前缀\(\min\) ,由于我们只要查询比当前定位妹子小的一段前缀,所以拿树状数组代替就是了. 由于这群妹子是神仙(年龄可达1e9),所以要离散化一下. 复杂度\(

HRBUST1356 Leyni,罗莉和队列 题解报告

题目传送门 [题目大意] [思路分析] 维护一个在身高单调递减的情况下,年龄也单调递减的序列,如果当前不满足递减,那么就要在前面存好的序列中找到年龄比当前小的最高的人并记录答案,找到符合条件的人可以用二分快速实现. [代码实现] 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #define rg register 5 #define il inline 6 #define get getch

loli的搜索测试-2

其实这已经是第四次搜索测试了...只不过上两次测试时我不在学校,扔两个链接吧: 测试-2:https://www.luogu.org/blog/user35178/loli-di-sou-suo-ce-shi-1-post 测试-3:https://www.luogu.org/blog/user35178/loli-di-sou-suo-ce-shi-2-post 远程感谢一下wzx dalao提供blog. 原文地址:https://www.cnblogs.com/shzr/p/9235245