Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class LDS {
- private static int najdolgaOpagackaSekvenca(int[] a) {
- int temp=1;
- int najdolga=1;
- for (int i=1;i<a.length;i++)
- {
- if (a[i]<=a[i-1]) temp++;
- else
- {
- if(najdolga<temp) najdolga=temp;
- temp=1;
- }
- }
- return najdolga;
- }
- public static void main(String[] args) {
- Scanner stdin = new Scanner(System.in);
- int n = stdin.nextInt();
- int a[] = new int[n];
- for (int i = 0; i < a.length; i++) {
- a[i] = stdin.nextInt();
- }
- System.out.println(najdolgaOpagackaSekvenca(a));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement