Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class VozrPosl {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner sc = new Scanner(System.in);
- int N = sc.nextInt();
- int[] arr = new int[N];
- for(int i = 0; i < N; i++) {
- arr[i] = sc.nextInt();
- }
- int Answer[] = new int[N];
- int Max = 0;
- for(int i = 0; i < N; i++) {
- Answer[i] = 1;
- for(int j = 0; j < i; j++) {
- if(arr[i] > arr[j] && Answer[j] + 1 > Answer[i]) {
- Answer[i] = Answer[j] + 1;
- }
- }
- Max = Math.max(Answer[i], Max);
- }
- System.out.println(Max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement