/images/jg_02.jpg

SW Expert Academy_D3 3975, 5176, ,

D3_3975_승률 비교하기

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
result = []
for T in range(int(input())):
    A, B, C, D = map(int, input().split())
    if B/A > D/C:
        result.append("BOB")
    elif B/A < D/C:
        result.append("ALICE")
    else:
        result.append("DRAW")

for t in range(T+1):
    print(f"#{t+1} {result[t]}")
    
# 아니 이게 D3라고? 완전 난이도 설정 실수네. 했다가 런타임 오류 보고
# 왜 그런건지 알았다.
# python은 결과를 모았다가 출력하는 게 더 빠르다.

SW Expert Academy_D3 3307, 3304, 4371, 10726

D3_3307_최장 증가 부분 수열(LIS)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
for T in range(int(input())):
    N = int(input())
    arr = list(map(int, input().split()))
    dp= [1] * N
    
    for i in range(1, N):
        for j in range(i):
            if arr[j] < arr[i]:
                dp[i]= max(dp[i], dp[j] + 1)

    print(f'#{T+1} {max(dp)}')

# dp는 쉬운듯 어렵고 어려운듯 쉽다...
# LIS로 검색하면 도움이 되는 글이 많다.