From 839755691912342367589f1db1d46f42c59ba84a Mon Sep 17 00:00:00 2001 From: hurjcs <8540239+hurjcs@user.noreply.gitee.com> Date: Fri, 11 Aug 2023 13:34:30 +0000 Subject: [PATCH] =?UTF-8?q?update=20problems/0027.=E6=9C=80=E9=95=BF?= =?UTF-8?q?=E5=A2=9E=E9=95=BF=E5=AD=90=E5=BA=8F=E5=88=97.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hurjcs <8540239+hurjcs@user.noreply.gitee.com> --- ...225\277\345\255\220\345\272\217\345\210\227.md" | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git "a/problems/0027.\346\234\200\351\225\277\345\242\236\351\225\277\345\255\220\345\272\217\345\210\227.md" "b/problems/0027.\346\234\200\351\225\277\345\242\236\351\225\277\345\255\220\345\272\217\345\210\227.md" index 7ad80a0..03e02c0 100644 --- "a/problems/0027.\346\234\200\351\225\277\345\242\236\351\225\277\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0027.\346\234\200\351\225\277\345\242\236\351\225\277\345\255\220\345\272\217\345\210\227.md" @@ -48,7 +48,19 @@ public class Main { ``` ## Python - +```python +n = int(input()) +for i in range(n): + strings = input().replace('[','').replace(']','') + nums = list(map(int,strings.split(','))) + n = len(nums) + dp = [1]*(n) + for i in range(n): + for j in range(i): + if(nums[i] > nums[j]): + dp[i] = max(dp[i],dp[j] + 1) + print(max(dp)) +``` ## Go ## Js -- Gitee