創造兩個數列
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int a,b;
cin >> a;
b=0;
int list1[10];
int list2[10];
cout << "Lumberjacks:" << "\n";
for(int i=0; i<a; i++)
{
for(int i=0; i<10; i++)
{
cin >> list1[i];
list2[i]=list1[i];
}
if(list1[i]<list1[i+1])
{
sort(list1,list1+10);
for(int i=0; i<10; i++)
{
if(list1[i]==list2[i])
{
b=b+1;
}
}
if(b==10)
{
cout << "Ordered" << "\n";
}
else
{
cout << "Unordered" << "\n";
}
b=0;
}
else if(list1[i]>list1[i+1])
{
sort(list1,list1+10,greater<int>());
for(int i=0; i<10; i++)
{
if(list1[i]==list2[i])
{
b=b+1;
}
}
if(b==10)
{
cout << "Ordered" << "\n";
}
else
{
cout << "Unordered" << "\n";
}
b=0;
}
else
{
continue;
}
}
}