백준의 알고리즘 2920 음계
#include <iostream>
#include <string>
int main()
{
int i = 0;
int ascending = 1;
int descending = 8;
int arr[8];
int index = 0;
for (i = 0; i < 8; i++) {
std::cin >> arr[i];
}
for (i = 0; i < 4; i++) {
if ((arr[i] + arr[7-i]) == 9) {
if(arr[i] < arr[7-i])
index += 1000;
else {
index += 100;
}
}
else {
index += 1;
}
}
if (index == 4000) {
std::cout << "ascending" << std::endl;
}
else if (index == 400) {
std::cout << "descending" << std::endl;
}
else {
std::cout << "mixed" << std::endl;
}
return 0;
}