Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Vishesh has gone to watch the new Spider-Man movie, but he is having troubles choosing which Popcorn-and-Coke combo to buy.
There are three combos A, B, and C available at the counter. You are given the time (in minute) for which each Popcorn bucket and Coke cup lasts. Given that Vishesh’s satisfaction from a combo is defined as the total lasting time (in minute) of the Popcorn bucket and the Coke cup, find the maximum satisfaction he can get by buying a single combo.
For each test case, output on a single line the maximum satisfaction Vishesh can get.
Input:
3
3 6
5 10
8 7
99 1
55 55
33 51
54 146
5436 627
1527 5421
Output:
15
110
6948
Therefore Vishesh’s maximum satisfaction is 15.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
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 e=sc.nextInt();
int f=sc.nextInt();
int k=a+b;
int h=c+d;
int j=e+f;
if(k>h && k>j)
{
System.out.println(k);
}
else if(h>k && h>j)
{
System.out.println(h);
}
else
{
System.out.println(j);
}
}
}
}
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int a1,a2,b1,b2,c1,c2;
cin>>a1>>a2>>b1>>b2>>c1>>c2;
int a=a1+a2;
int b=b1+b2;
int c=c1+c2;
if(a>b && a>c){
cout<<a<<endl;
}
else if(b>c){
cout<<b<<endl;
}
else{
cout<<c<<endl;
}
}
return 0;
}
# cook your dish here
for _ in range(int(input())):
ans = 0
for i in range(3):
ans = max([sum([int(x) for x in input().split()]), ans])
print(ans)
In our experience, we suggest you solve this Vishesh and his Popcorn Combo 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 Vishesh and his Popcorn Combo CodeChef Solution
I hope this Vishesh and his Popcorn Combo 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 >>