original problem: ccc21j2
A charity is having a silent auction where people place bids on a prize without knowing anyone else's bid. Each bid includes a person's name and the amount of their bid. After the silent auction is over, the winner is the person who has placed the highest bid. If there is a tie, the person whose bid was placed first wins. Your job is to determine the winner of the silent auction.
My question:
1. How to match "name" and "amount"?
A: just put them all into for loop
2. How to compare the amount between different input?
A:set the first of them as a constant variable, then use for loop
#CCC '21 J2 - Silent Auction
#2021-08-22
#E SUN
num=int(input())
highestbid=0
for i in range(num):
name=input()
amount=int(input())
if amount>highestbid:
winner=name
highestbid=amount
print(winner)
In this problem, I set the first input as winner and highestbid(the constant variable), so next time I can compare the second input with the first one, the "winner" join the next game!