#27926: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

學校 : 臺北市立和平高級中學
編號 : 163096
來源 : [61.64.210.174]
最後登入時間 :
2022-10-23 16:54:59
e533. 11942 - Lumberjack Sequencing -- UVA | From: [219.85.43.159] | 發表日期 : 2021-11-06 00:05

#include <iostream>
using namespace std;

int main(){
int n, a[10];
cin >> n;
cout <<"Lumberjacks:\n";
while (n--){
for (int i=0; i<10; i++){
cin >> a[i];
}
bool acd=a[1]>a[0];
bool order=true;
for (int i=0; i<9; i++){
if (acd && a[i]>a[i+1]){
order=false;
break;
}
else if (!acd && a[i]<a[i+1]){
order=false;
break;
}
}
if (order){
cout <<"Ordered\n";
}
else {
cout <<"Unordered\n";
}
}
}
 
ZeroJudge Forum