Problem
Read problem statements in Vietnamese,
Bengali, Mandarin Chinese, and Russian as well.
Chefland has different types of coconut, type and type . Type contains only milliliters of coconut water and type contains only grams of coconut pulp. Chef's nutritionist has advised him to consume milliliters of coconut water and grams of coconut pulp every week in the summer. Find the total number of coconuts (type + type ) that Chef should buy each week to keep himself active in the hot weather.
Input
- The first line contains an integer , the number of test cases. Then the test cases follow.
- Each test case contains a single line of input, four integers , , , .
Output
For each test case, output in a single line the answer to the problem.
Constraints
- divides .
- divides .
Subtasks
Subtask #1 (100 points): original constraints
Sample 1:
3 100 400 1000 1200 100 450 1000 1350 150 400 1200 1200
13 13 11
Explanation:
TestCase : Number of coconuts of Type required = and number of coconuts of Type required = . So the total number of coconuts required is .
TestCase : Number of coconuts of Type required = and number of coconuts of Type required = . So the total number of coconuts required is .
TestCase : Number of coconuts of Type required = and number of coconuts of Type required = . So the total number of coconuts required is .
Program :
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sr = new Scanner(System.in);
int t = sr.nextInt();
while(t-- >0)
{
int a,b,x,y;
a = sr.nextInt();
b = sr.nextInt();
x = sr.nextInt();
y = sr.nextInt();
System.out.println((x/a)+(y/b));
}
}
}
0 Comments