Leyni, LOLI and Toasts

Source: Internet
Author: User

Leyni, LOLI and Toasts
 Time limit:1000 MS Memory limit:65536 K
 Total submit:47(Notoginseng users) Total accepted:37(Notoginseng users) Rating: Special Judge: No
Description

Leyni likes to play with Lolis, but this winter are 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 the 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. Have the average materials, the lolis want to make toasts as many as they can. How many toasts can each LOLI makes?

Input

There is multiple test cases. The first line of input was 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< /c8>, y (1≤ N, b, D, L, K, p, x, y ≤1000). The numbers is 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 has 4 * 5 = milliliters of the drink, it is enough to make 20/3 = 6 toasts. The limes was enough for 8 = toasts and the salt was enough for 100/1 = toasts. However, there is 3 Lolis in the group and so the answer is 6/3 = 2.

Source
Harbin Tech 2012 Spring School race-Live race
Author
Zidaratu @hrbust
#include <cstdio>#include<cmath>#include<queue>#include<iostream>using namespacestd;intMinintXinty) {    returnX<y?x:y;}intMain () {intN, B, D, L, K, p, X, y; intT;  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//    {                intNum1=b*d/(nx); intnum2=l*k/N; intnum3=p/(y*N); printf ("%d\n", Min (num1,min (NUM2,NUM3))); //    }        }    }    return 0;}

Leyni, LOLI and Toasts

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• Sales Support

1 on 1 presale consultation

• After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.