Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1.  
  2. import java.io.BufferedReader;
  3. import java.io.IOException;
  4. import java.io.InputStreamReader;
  5.  
  6. public class asiuf {
  7.  
  8. public static void main(String[] args) throws IOException {
  9. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  10. short num = Short.parseShort(br.readLine());
  11. short[] arr = new short[num];
  12.  
  13. maximalIncreasingSequence(br, num, arr);
  14. }
  15.  
  16. private static void maximalIncreasingSequence(BufferedReader br, short num, short[] arr) throws IOException {
  17. short maxSubStrLength = 1;
  18. short tempMaxLength = 1;
  19. arr[0] = Short.parseShort(br.readLine());
  20. for (short i = 1; i < num; i++) {
  21. arr[i] = Short.parseShort(br.readLine());
  22. if (arr[i - 1] < arr[i]) {
  23. ++tempMaxLength;
  24. } else {
  25. tempMaxLength = 1;
  26. }
  27.  
  28. if (tempMaxLength > maxSubStrLength) {
  29. maxSubStrLength = tempMaxLength;
  30. }
  31. }
  32. System.out.println(maxSubStrLength);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement