adplus-dvertising

Interior Design CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

Interior Design CodeChef Solution

Interior Design CodeChef Solution

Interior Design 

Chef decided to redecorate his house, and now needs to decide between two different styles of interior design.

For the first style, tiling the floor will cost X1X1 rupees and painting the walls will cost Y1Y1 rupees.

For the second style, tiling the floor will cost X2X2 rupees and painting the walls will cost Y2Y2 rupees.

Chef will choose whichever style has the lower total cost. How much will Chef pay for his interior design?

Input Format

  • The first line of input will contain a single integer¬†TT, denoting the number of test cases.
  • Each test case consists of a single line of input, containing¬†44¬†space-separated integers¬†X1,Y1,X2,Y2X1,Y1,X2,Y2¬†as described in the statement.

Interior Design CodeChef Solution

Output Format

For each test case, output on a new line the amount Chef will pay for interior design.

Constraints

  • 1‚ȧT‚ȧ1001‚ȧT‚ȧ100
  • 1‚ȧX1,Y1,X2,Y2‚ȧ1001‚ȧX1,Y1,X2,Y2‚ȧ100

Sample Input 1 

4
10 20 9 25
10 20 9 20
10 20 20 10
100 43 85 61

Sample Output 1 

30
29
30
143

Explanation

Interior Design CodeChef Solution

Test case 11: The first style costs 10+20=3010+20=30 rupees, and the second costs 9+25=349+25=34 rupees. The first is cheaper, so Chef will pay 3030 rupees.

Test case 22: The first style costs 10+20=3010+20=30 rupees, and the second costs 9+20=299+20=29 rupees. The second is cheaper, so Chef will pay 2929 rupees.

Test case 33: The first style costs 10+20=3010+20=30 rupees, and the second costs 20+10=3020+10=30 rupees. Both styles cost the same, so Chef is always going to pay 3030 rupees.

Test case 44: The first style costs 100+43=143100+43=143 rupees, and the second costs 85+61=14685+61=146 rupees. The first is cheaper, so Chef will pay 143143 rupees.

SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE

Related Posts

Leave a Reply

Your email address will not be published.