Logo
(追記) (追記ここまで)

25829번 - Presidential Election 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB30423320878.195%

문제

Presidential election is coming up (November). In 2016, Clinton won the “majority” votes but Trump ended up with more “electoral” votes and won the race. (As a reminder, if a candidate receives more votes in a state, that candidate wins all the electoral votes for that state, i.e., electoral votes for a state are not divided proportionally based on the votes received by each candidate in that state.)

Election is in less than two months so let’s predict the outcome! Given the voting data for each state, determine who wins the majority votes and who wins the electoral votes.

입력

The first input line contains an integer, n (1 ≤ n ≤ 50), indicating the number of states. Each of the next n input lines contains three integers, providing voting data for a state: e (1 ≤ e ≤ 100), indicating electoral votes for the state, v1 (0 ≤ v1 ≤ 1000), indicating votes for the first candidate, and v2 (0 ≤ v2 ≤ 1000; v2 ≠ v1), indicating votes for the second candidate.

출력

Print 1 (one) if the first candidate wins both the majority votes and the electoral votes. Print 2 (two) if the second candidate wins both the majority votes and the electoral votes. Print 0 (zero) for all the other cases. Assume that if the total majority votes for the two candidates tie, neither one wins the majority. Similarly, if the total electoral votes for the two candidates tie, neither one wins the electoral.

제한

예제 입력 1

3
5 10 50
15 30 60
10 25 15

예제 출력 1

2

예제 입력 2

3
5 48 50
15 57 60
10 25 15

예제 출력 2

0

힌트

출처

University > University of Central Florida > 2020 Local Programming Contest (Final Round) 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /