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 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…
  • 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…
  •  ProblemChef has N slippers, L of which are left slippers and the rest are right slippers. Slippers must always be sold in pairs, where each pair contains one left and one rig…
  • Problem Gru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions' incapability which has kept him…
  • 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…
  •  ProblemYou're given an integer N. Write a program to calculate the sum of all the digits of N. Please Share this article... Input Format The first line contains an intege…

Post a Comment