문제출처 : https://www.acmicpc.net/problem/2920
#include <iostream>
using namespace std;
int main()
{
int arr[8], flag = -1, isflagchange = 0;
for (int i = 0; i < 8; i++)
cin >> arr[i];
for (int i = 0; i < 7; i++)
{
if (arr[i] < arr[i + 1])
{
if (flag != 0)isflagchange++;
flag = 0;
}
else if (arr[i] > arr[i + 1])
{
if (flag != 1)isflagchange++;
flag = 1;
}
}
if (isflagchange > 1)
flag = 2;
switch (flag)
{
case 0:
cout << "ascending";
break;
case 1:
cout << "descending";
break;
case 2:
cout << "mixed";
break;
}
return 0;
}