Please Fill out the Feedback Form for Code Radius

Challenge for Most Difficult Problem : CHMDFP032 | Codechef Solution

3 min read

Problem

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 S_P, S_Q, S_RSP​,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 Alice.
  2. If Bob wins the challenge (that is, if problem QQ is the most difficult), then output Bob.
  3. If no one wins the challenge (since problem PP is the most difficult), output Draw.

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 S_P, S_Q, S_RSP​,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

Sample

Input
3
1 4 2
16 8 10
14 15 9
Output
Draw
Bob
Alice

Explanation

Test case 1: Because problem PP turns out to be the most difficult, no one wins the challenge.
Test case 2: Problem QQ proves to be the most difficult, thus Bob wins the challenge.
Test case 3: Problem RR proves to be the most difficult, thus Alice wins the challenge.

Solution

cpp
#include <iostream> #include<vector> #include<string> using namespace std; int main() { int t,a,b,c; cin>>t; vector<string> ans; for(int i=0;i<t;i++){ cin>>a>>b>>c; if(a<b){ if(a<c) ans.push_back("Draw"); else ans.push_back("Alice"); } else{ if(b<c) ans.push_back("Bob"); else ans.push_back("Alice"); } } for(int i=0;i<t;i++) cout<<ans[i]<<endl; return 0; }

Please First Try to Solve Problem by Yourself.

You may like these posts

  • Problem Pooja would like to withdraw X $US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash …
  • Problem Chef has just started Programming, he is in first year of Engineering. Chef is reading about Relational Operators.Relational Operators are operators which check relati…
  • Problem Write a program to obtain a number NN and increment its value by 1 if the number is divisible by 4 otherwise decrement its value by 1. Please Share this article... …
  • Problem In a Chess match "a + b", each player has a clock which shows a minutes at the start and whenever a player makes a move, b seconds are added to this player's clock. Ti…
  • Problem Write a program to take two numbers as input and print their difference if the first number is greater than the second number otherwise print their sum. Please Share…
  • Problem The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Ou…

Post a Comment