BOJ 2920. 음계 (Python)
2021. 2. 5. 23:13ㆍProblem Solving/BOJ
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')
반응형
'Problem Solving > BOJ' 카테고리의 다른 글
BOJ 11654. 아스키 코드 (C, Python) (0) | 2021.02.06 |
---|---|
BOJ 8958. OX퀴즈 (Python) (0) | 2021.02.05 |
BOJ 2639. 구구단 (Python) (0) | 2021.02.05 |
BOJ 2675. 문자열 반복 (Python) (0) | 2021.02.05 |
BOJ 2667. 단지 번호 붙이기 (Python) (0) | 2021.01.27 |