Guest User

Untitled

a guest
Mar 24th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class UVa11764 {
  4. public static void main(String args[]) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int T = sc.nextInt();
  8. for (int i = 1; i <= T; i++) {
  9. int N = sc.nextInt();
  10.  
  11. int arr[] = new int[N];
  12. int h = 0;
  13. int l = 0;
  14.  
  15. for (int j = 0; j < N; j++)
  16. arr[j] = sc.nextInt();
  17.  
  18. int current = arr[0];
  19. for (int j = 1; j < N; j++) {
  20. if (current < arr[j])
  21. h++;
  22. else if(current > arr[j])
  23. l++;
  24. current = arr[j];
  25. }
  26. System.out.println("Case " + i + ": " + h + " " + l);
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment