Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Interior Design CodeChef Solution

Problem – Interior Design CodeChef Solution

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 X1​ rupees and painting the walls will cost Y1​ rupees.

For the second style, tiling the floor will cost X2​ rupees and painting the walls will cost Y2​ 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 T, denoting the number of test cases.
  • Each test case consists of a single line of input, containing 4 space-separated integers X1​,Y1​,X2​,Y2​ as described in the statement.

Output Format

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

Constraints

  • 1≤T≤100
  • 1≤X1​,Y1​,X2​,Y2​≤100

Sample 1:

Input: 4
10 20 9 25
10 20 9 20
10 20 20 10
100 43 85 61
Output: 30
29
30
143

Explanation:

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

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

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

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

Interior Design CodeChef Solution in Pyth 3

t = int(input())
for i in range(t):
    x1,y1,x2,y2=map(int,input().split())
    print(min(x1+y1,x2+y2))

Interior Design CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc= new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0){
		    int a = sc.nextInt();
		     int b = sc.nextInt();
		      int c = sc.nextInt();
		       int d = sc.nextInt();
		       int a1 = a+b;
		       int a2 = c+d;
		       System.out.println(Math.min(a1,a2));
		}
	}
}

Interior Design CodeChef Solution in C++17

#include <iostream>
#include<algorithm>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int a,b,x,y;
	    cin>>a>>b>>x>>y;
	    int a1 = a+b;
	    int a2 = x+y;
	    std::cout << min(a1,a2) << std::endl;
	}
	return 0;
}
Interior Design CodeChef Solution Review:

In our experience, we suggest you solve this Interior Design CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Interior Design CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Interior Design CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *