개발자 톡

연습문제 톡 징검다리

징검다리 반례 부탁드립니다

등록일
2023-11-03 02:46:47
조회수
552
작성자
gwioong1
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int loop = Integer.parseInt(br.readLine());
        int[] stones = new int[loop];

        StringTokenizer st = new StringTokenizer(br.readLine());
        for (int i = 0; i < loop; i++) {
            stones[i] = Integer.parseInt(st.nextToken());
        }

        int count = 1;
        int max = 1;
        for (int j = 0; j < loop - 1; j++) {
            if (stones[j] < stones[j + 1]) {
                count++;
            } else {
                count = 1;
            }

            if (count > max) {
                max = count;
            }
        }
        System.out.print(max);

    }

}


#징검다리
#java

이 카테고리의 톡 더보기