Problem Solving/BOJ
BOJ 2920. 음계 (Python)
yuseon-Lim
2021. 2. 5. 23:13
BOJ 2920. 음계
https://www.acmicpc.net/problem/2920
2920번: 음계
다장조는 c d e f g a b C, 총 8개 음으로 이루어져있다. 이 문제에서 8개 음은 다음과 같이 숫자로 바꾸어 표현한다. c는 1로, d는 2로, ..., C를 8로 바꾼다. 1부터 8까지 차례대로 연주한다면 ascending, 8
www.acmicpc.net
Solution
play = list(map(int, input().split()))
tmp = []
for i in range(1, 8):
if play[i-1] < play[i]:
tmp.append(1)
else:
tmp.append(-1)
if 1 in tmp and -1 in tmp:
print('mixed')
elif 1 in tmp and -1 not in tmp:
print('ascending')
elif -1 in tmp and 1 not in tmp:
print('descending')

반응형