지나가던 개발자
[Python] 백준 2456번(나는 학급회장이다) 문제 풀이 본문
tensyu = [0, 0, 0]
santen = [0, 0, 0]
niten = [0, 0, 0]
for i in range(int(input())):
a = list(map(int, input().split()))
tensyu[0] += a[0]
tensyu[1] += a[1]
tensyu[2] += a[2]
if a[0] == 3:
santen[0] += 1
elif a[1] == 3:
santen[1] += 1
else:
santen[2] += 1
if a[0] == 2:
niten[0] += 1
elif a[1] == 2:
niten[1] += 1
else:
niten[2] += 1
#print(tensyu, santen, niten)
if len(set(tensyu)) == len(tensyu):
print(tensyu.index(max(tensyu))+1, max(tensyu))
else:
printed = False
if len([x for x in santen if x==max(santen)])==1:
if tensyu[santen.index(max(santen))] == max(tensyu):
print(santen.index(max(santen))+1, max(tensyu))
printed = True
if not printed:
if len([x for x in niten if x==max(niten)])==1:
if tensyu[niten.index(max(niten))] == max(tensyu):
print(niten.index(max(niten))+1, max(tensyu))
printed = True
if not printed:
print(0, max(tensyu))
백준... 굉장히 오랜만에 푸는데 감이 다 죽은 것 같다. 브론즈I 문제를 이렇게 길게 풀다니.
'PS > Python' 카테고리의 다른 글
[Python] 백준 17254번(키보드 이벤트) 문제 풀이 (0) | 2023.08.14 |
---|---|
[Python] 코드업 5078번(삼각형의 형태) 문제 풀이 (0) | 2023.08.02 |
[Python] 백준 11047번(동전 0) 문제 풀이 (0) | 2023.03.09 |
[Python] 백준 5585번(거스름돈) 문제 풀이 (0) | 2023.02.25 |
[Python] 백준 17219번(비밀번호 찾기) 문제 풀이 (0) | 2023.01.10 |
Comments