GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Thursday 28 July 2022

[Solution] Maximise the Tastiness CodeChef Solution


Problem

Chef is making a dish that consists of exactly two ingredients. He has four ingredients A, B, C and D with tastiness a, b, c, and d respectively. He can use either A or B as the first ingredient and either C or D as the second ingredient.

The tastiness of a dish is the sum of tastiness of its ingredients. Find the maximum possible tastiness of the dish that the chef can prepare.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

  • The first and only line of each test case contains four space-separated integers a, b, c, and d — the tastiness of the four ingredients.

Output Format

For each test case, output on a new line the maximum possible tastiness of the dish that chef can prepare.


Explanation:

Test case 1: Chef can prepare a dish with ingredients B and C with a tastiness of 5+6=11.

Test case 2: Chef can prepare a dish with ingredients A and C with a tastiness of 16+5=21.

No comments:

Post a Comment