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
728x90
반응형
'Problem Solving' 카테고리의 다른 글
1-6. Pascal's Triangle (LeetCode 118) (0) | 2021.07.07 |
---|---|
1-5. Plus One (LeetCode 66) (0) | 2021.07.07 |
1-4. 평균은 넘겠지 (백준 4344) (0) | 2021.07.07 |
1-3. Assign Cookies (LeetCode 455) (0) | 2021.07.07 |
1-2. 스킬트리 (프로그래머스 summer/winter coding 2018) (0) | 2021.07.07 |
댓글