INTRDSGN-Editorial

PROBLEM LINK:

Contest
Practice

Setter: iceknight1093
Testers: gamegame
Editorialist: kiran8268

DIFFICULTY:

373

PREREQUISITES:

None

PROBLEM:

Chef decided to redecorate his house, and now he has two available styles. He’ll choose whichever style has the lower total cost. Our objective is to find how much will Chef pay for his interior design?

EXPLANATION:

  • For the first style, tiling the floor will cost X_1 rupees and painting the walls will cost Y_1 rupees.

  • For the second style, tiling the floor will cost X_2 rupees and painting the walls will cost Y_2 rupees.

  • The total cost of first style is X_1+Y_1 and that of second style is X_2+Y_2.

  • Our objective is to find the minimum among the cost of style 1 and style 2 and output the minimum cost.

TIME COMPLEXITY:

Time complexity is O(1).

SOLUTION:

Editorialist's Solution
	int t;
	cin>>t;
	while(t--)
	{
	    int a,b,c,d;
	    cin>>a>>b>>c>>d;
	    cout<<min((a+b),(c+d))<<"\n";
	}