Problem Solving
1-1. 음계 판별하기 (백준 2920)
tls1107
2021. 7. 7. 00:46
728x90
반응형
#include <iostream>
using namespace std;
int main(){
int a[8];
for(int i = 0 ; i < 8 ; i++)
cin >> a[i];
if(a[0] == 1){
for(int i = 1 ; i < 8 ; i++){
if(a[i] != ( a[i-1] + 1 ) ) {
cout << "mixed" << endl;
return 0;
}
}
cout << "ascending" << endl;
}
else if(a[0] == 8){
for(int i = 1 ; i < 8 ; i++){
if(a[i] != ( a[i-1] - 1 ) ) {
cout << "mixed" << endl;
return 0;
}
}
cout << "descending" << endl;
}
else cout << "mixed" << endl;
return 0;
}
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
728x90
반응형