Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class increasingElements {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int countLong = 0;
- int countTempLong = 0;
- int num = 0;
- int numPerv = 0;
- for (int i = 1; i <= n; i++) {
- num = Integer.parseInt(scanner.nextLine());
- if (num > numPerv) {
- countTempLong++;
- } else {
- countTempLong = 1;
- }
- numPerv = num;
- if (countTempLong > countLong) {
- countLong = countTempLong;
- }
- }
- System.out.println(countLong);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement