슈도코드 2019. 9. 19. 23:15

#include <iostream>
using namespace std;

int main(void)
{
	int a[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
	int b[8] = { 8, 7, 6, 5, 4, 3, 2, 1 };
	int c[8];
	int i = 0, j = 0;

	for (int i = 0; i < 8; i++)
		cin >> c[i];

	while (1)
	{
		if (c[i] == a[i]) //c, a 요소 비교
		{
			i++;
			if (i == 8)
			{
				cout << "ascending" << '\n';
				break;
			}
		}
		else if (c[j] == b[j]) //c, b 요소 비교
		{
			j++;
			if (j == 8)
			{
				cout << "descending" << '\n';
				break;
			}
		}
		else
		{
			cout << "mixed" << '\n';
			break;
		}
	}
	return 0;
}