complete 1463, 1931, 2156, 11053
This commit is contained in:
15
zeta_python/completed/11053.py
Normal file
15
zeta_python/completed/11053.py
Normal file
@@ -0,0 +1,15 @@
|
||||
N = int(input())
|
||||
A = list(map(int, input().split()))
|
||||
|
||||
T = [0 for _ in range(N)]
|
||||
T[0] = 1
|
||||
|
||||
for i in range(1, N):
|
||||
t = []
|
||||
for j in range(i):
|
||||
if A[j] < A[i]:
|
||||
t.append(T[j] + 1)
|
||||
else:
|
||||
t.append(1)
|
||||
T[i] = max(t)
|
||||
print(max(T))
|
||||
15
zeta_python/completed/1463.py
Normal file
15
zeta_python/completed/1463.py
Normal file
@@ -0,0 +1,15 @@
|
||||
N = int(input())
|
||||
|
||||
T = [0, ]
|
||||
|
||||
for i in range(1, N):
|
||||
new = i + 1
|
||||
t = []
|
||||
if new % 3 == 0:
|
||||
t.append(T[new // 3 - 1] + 1)
|
||||
if new % 2 == 0:
|
||||
t.append(T[new // 2 - 1] + 1)
|
||||
t.append(T[new - 1 - 1] + 1)
|
||||
T.append(min(t))
|
||||
|
||||
print(T[-1])
|
||||
13
zeta_python/completed/1931.py
Normal file
13
zeta_python/completed/1931.py
Normal file
@@ -0,0 +1,13 @@
|
||||
N = int(input())
|
||||
I = [tuple(map(int, input().split())) for _ in range(N)]
|
||||
|
||||
I.sort(key=lambda x: (x[1], x[0]))
|
||||
|
||||
last = 0
|
||||
cnt = 0
|
||||
for i in range(N):
|
||||
if last <= I[i][0]:
|
||||
last = I[i][1]
|
||||
cnt += 1
|
||||
|
||||
print(cnt)
|
||||
15
zeta_python/completed/2156.py
Normal file
15
zeta_python/completed/2156.py
Normal file
@@ -0,0 +1,15 @@
|
||||
N = int(input())
|
||||
I = [int(input()) for i in range(N)]
|
||||
|
||||
T = [[0 for _ in range(3)] for _ in range(N)]
|
||||
|
||||
T[0][0] = 0
|
||||
T[0][1] = I[0]
|
||||
T[0][2] = 0
|
||||
|
||||
for i in range(1, N):
|
||||
T[i][0] = max((T[i-1][0], T[i - 1][1], T[i - 1][2]))
|
||||
T[i][1] = T[i - 1][0] + I[i]
|
||||
T[i][2] = T[i - 1][1] + I[i]
|
||||
|
||||
print(max(T[-1]))
|
||||
Reference in New Issue
Block a user