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

Post a Comment