Challenge for Most Difficult Problem : CHMDFP032

                     

Challenge for Most Difficult Problem CodeChef solution in C, C++, JAVA, Python

CU Submission link: Click here (need login by CU account)


In a competition, there are three 33 problems: P,Q,RP,Q,R. Alice challenges Bob that problem RR will be the most difficult, whereas Bob predicts that problem QQ will be the most difficult.

You are given three integers SP,SQ,SRSP,SQ,SR, which represent the number of successful submissions of the problems P,Q,RP,Q,R. Each problem is guaranteed to have a varied amount of submissions. Decide who will win the challenge.

1) If Alice wins the challenge (that is, if problem RR is the most difficult), then output AliceAlice.

2) If Bob wins the challenge (that is, if problem QQ is the most difficult), then output BobBob.

3) If no one wins the challenge (since problem PP is the most difficult), output DrawDraw.

Note: The problem with the fewest successful submissions is the most difficult.

Input Format

  • The first line of input contains a single integer TT, which represents the number of test cases. The following is a description of TT test cases.
  • Each test case’s first and only line comprises three space-separated integers SP,SQ,SRSP,SQ,SR, which represent the number of successful submissions of problems P,Q,RP,Q,R, respectively.

Output Format

  • For each test case, print the winner of the challenge or the word “Draw” if no one wins the challenge.

Constraints

  • 1≤T≤1001≤T≤100
  • 1≤SP,SQ,SR≤1001≤SP,SQ,SR≤100
  • SP,SQ,SRSP,SQ,SR are all distinct.

Sample Input 1 

3
1 4 2
16 8 10
14 15 9

Sample Output 1 

Draw
Bob
Alice

Explanation

Test case 11: Because problem PP turns out to be the most difficult, no one wins the challenge.

Test case 22: Problem QQ proves to be the most difficult, thus Bob wins the challenge.

Test case 33: Problem RR proves to be the most difficult, thus Alice wins the challenge.


Challenge for Most Difficult Problem CodeChef solution in C

int main()
{

// your code goes here
    int t;
	scanf("%d",&t);
	while(t--)
	{

	int p,q,r;
	scanf("%d %d %d",&p,&q,&r);
	if(p < q && p < r)
	{
		printf("Draw\n");
	}
	else if(q < r)
	{
		printf("Bob\n");
	}
	else
	{
		printf("Alice\n");
	}
	}
	return 0;
}

Challenge for Most Difficult Problem CodeChef solution in C++ 14


int main() {
 
    int t;
    cin>>t;
    while(t--) {
        int p,q,r;
        cin >>p>>q>>r;
    if (p < q && p < r) {
        cout << "Draw" << endl;
    } else if (q < p && q < r)  {
       cout << "Bob" << endl;
    } else {
      cout << "Alice"<< endl;

     }
    }
 
      return 0;
}

Challenge for Most Difficult Problem CodeChef solution in Python 3

soon 

Challenge for Most Difficult Problem CodeChef solution in Java

/* 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();
if(a <=b && a <=c)  
System.out.println("Draw");  
else if (b <= a && b <=c)  
System.out.println("Bob");  
else  
System.out.println("Alice");  
}  
	}
}

More Codechef Solution: Click Here


Challenge for Most Difficult Problem CodeChef solution

Challenge for Most Difficult Problem CodeChef solution
Challenge for Most Difficult Problem CodeChef solution