From 9727966d64009b2a7f10a3e4f6346d8ff6f8960e Mon Sep 17 00:00:00 2001 From: vrexpert Date: Thu, 2 May 2024 01:27:47 +0900 Subject: [PATCH] 2024-05-01 solved --- SeongHoonC/README.md | 1 + ...0\353\266\204 \354\210\230\354\227\264.kt" | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 "SeongHoonC/dp/\352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.kt" diff --git a/SeongHoonC/README.md b/SeongHoonC/README.md index bfe3752..72920a3 100644 --- a/SeongHoonC/README.md +++ b/SeongHoonC/README.md @@ -23,4 +23,5 @@ | 19차시 | 2024.04.04 | 그리디 | 큰 수 만들기 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/72 | | 20차시 | 2024.04.07 | DP | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/75 | | 21차시 | 2024.04.11 | DP | RGB거리 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/77 | +| 21차시 | 2024.05.01 | DP | 가장 긴 증가하는 부분 수열 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/80 | --- diff --git "a/SeongHoonC/dp/\352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.kt" "b/SeongHoonC/dp/\352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.kt" new file mode 100644 index 0000000..df50443 --- /dev/null +++ "b/SeongHoonC/dp/\352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.kt" @@ -0,0 +1,20 @@ +import java.io.BufferedReader +import java.io.InputStreamReader +import kotlin.math.max + +fun main() { + val br = BufferedReader(InputStreamReader(System.`in`)) + val n = br.readLine().toInt() + val arr = br.readLine().split(" ").map { it.toInt() } + + val answer = Array(n) { 1 } + + for (now in 1 until n) { + for (target in 0 until now) { + if (arr[target] < arr[now]) { + answer[now] = max(answer[now], answer[target] + 1) + } + } + } + println(answer.max()) +} \ No newline at end of file