[Python] 백준 2816번 - 디지털 티비

유빈·2025년 1월 8일
0

Algorithms

목록 보기
16/35
post-thumbnail

백준 문제집 PS

ses0028님의 "IT기업 및 대기업 계열사 코테보면서 비슷했던 문제들(지속적으로 업데이트 중)" (현재 기준 89문제)

이번 방학 2달동안 다 푸는 것이 목표입니다.

25.01.08 - 브론즈 5문제

문제문제 제목문제 티어문제 링크
23971ZOAC 4브론즈 3https://www.acmicpc.net/problem/23971
5073삼각형과 세 변브론즈 3https://www.acmicpc.net/problem/5073
2292벌집브론즈 2https://www.acmicpc.net/problem/2292
1157단어 공부브론즈 1https://www.acmicpc.net/problem/1157
2816디지털 티비브론즈 1https://www.acmicpc.net/problem/2816


2816번 - 디지털 티비


전체 코드 및 설명

input = open(0).readline

channels = list()
for i in range(N := int(input())):
    channels.append(c := input().strip())

idx1, idx2 = channels.index("KBS1"), channels.index("KBS2")

button = ""

if idx1 > idx2:
    idx2 += 1

button += '1'*idx1 + '4'*idx1 + '1'*idx2 + '4'*(idx2-1)
print(button)
profile
🌱

0개의 댓글