Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link

Summer Heat : COCONUT | CodeChef Solution

 

Problem

Chefland has 2 different types of coconut, type A and type B. Type A contains only x_a milliliters of coconut water and type B contains only x_b grams of coconut pulp. Chef's nutritionist has advised him to consume X_a milliliters of coconut water and X_b grams of coconut pulp every week in the summer. Find the total number of coconuts (type A + type B) that Chef should buy each week to keep himself active in the hot weather.

Please Share this article...

Input Format

The first line contains an integer TT, the number of test cases. Then the test cases follow.
Each test case contains a single line of input, four integers x_a, x_b, X_a, X_b.

Output Format

For each test case, output in a single line the answer to the problem.

Constraints

Sample

Input
3
100 400 1000 1200
100 450 1000 1350
150 400 1200 1200
Output
13
13
11

Explanation

TestCase 1: Number of coconuts of Type A required = 1000/100 = 10 and number of coconuts of Type B required = 1200/400 = 3. So the total number of coconuts required is 10 + 3 = 13.
TestCase 2: Number of coconuts of Type A required = 1000/100 = 10 and number of coconuts of Type B required = 1350/450 = 3 . So the total number of coconuts required is 10 + 3 = 13.
TestCase 3: Number of coconuts of Type A required = 1200/400 = 8 and number of coconuts of Type B required = 1200/400 = 3. So the total number of coconuts required is 8 + 3 = 11.

Solution

#include <iostream>
using namespace std;

// Solution from : Code Radius [ https://radiuscode.blogspot.com/ ]

int main() {
    int t;
    cin>>t;
    while(t--){
        
	int a,b,A,B;
	cin>>a>>b>>A>>B;
	cout<<A/a+B/b<<endl;
    }
    
	return 0;

}
Please First Try to Solve Problem by Yourself.
I am Devesh Singh, Student in Varanasi India . I like to write blog on technology and ethical hacking and other tricks or solutions to problem that anyone face during using technology and Internet.

Post a Comment

© Code Radius 2. All rights reserved. Distributed by Techy Darshan Distributed by Pro Templates