 # AUCTION-Editorial

Setter: Jeevan Jyot Singh
Tester: Satyam, Jatin Garg
Editorialist: Kiran

330

None

# PROBLEM:

Alice, Bob, and Charlie are bidding for an artifact at an auction. Alice, Bob and Charlie bids for A rupees, B rupees and C rupees respectively. According to the rules of the auction, the person who bids the highest amount will win the auction. The objective is to find the winner.

# EXPLANATION:

• The objective of this problem is to input three distinct values, compare its values
and return the highest value.

• We input three distinct values to three variables A, B & C (representing Alice, Bob, and Charlie). Let’s compare the three variables using a max function and return the highest value.

• Solution:

1. If A has the max value, Alice is the winner.

2. If B has the max value, Bob is the winner.

3. If C has the max value, Charlie is the winner.

O(1)

# SOLUTION:

Editorialist's Solution
``````int t;
cin>>t;
for(int i=0;i<t;i++)
{
int a,b,c,d;
cin>>a>>b>>c;
d=max(a,max(b,c));
if(d==a)
cout<<"Alice"<<"\n";
else if(d==b)
cout<<"Bob"<<"\n";
else
cout<<"Charlie"<<"\n";

}
``````