Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* package whatever; // don't place package name! */
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- /* Name of the class has to be "Main" only if the class is public. */
- class Main
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- Scanner scan = new Scanner(System.in);
- int testCase = scan.nextInt();
- System.out.println("Lumberjacks:");
- while(testCase--!=0){
- int first = scan.nextInt();
- int second = scan.nextInt();
- boolean result = true;
- String order = "";
- if(first > second) order = "dec";
- else order = "inc";
- for(int i = 0;i<8;i++){
- int temp = scan.nextInt();
- if(temp < second && order.equals("inc")) result = false;
- if(temp > second && order.equals("dec")) result = false;
- second = temp;
- }
- if(result) System.out.println("Ordered");
- else System.out.println("Unordered");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement