목록Problem Solving (223)
Life Engineering
www.acmicpc.net/problem/2156 2156번: 포도주 시식 효주는 포도주 시식회에 갔다. 그 곳에 갔더니, 테이블 위에 다양한 포도주가 들어있는 포도주 잔이 일렬로 놓여 있었다. 효주는 포도주 시식을 하려고 하는데, 여기에는 다음과 같은 두 가지 규 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 n = int(input()) d=[0]*n array=[] for _ in range(n): array.append(int(input())) for i in range(n): if i==0: d[0]=array[0] elif i==1: d[1]=d[0]+array[1] elif i==2: d[2]=max(array[0], array[1]..
www.acmicpc.net/problem/9465 9465번: 스티커 첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스의 첫째 줄에는 n (1 ≤ n ≤ 100,000)이 주어진다. 다음 두 줄에는 n개의 정수가 주어지며, 각 정수는 그 위치에 해당하는 스티커의 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 T = int(input()) for _ in range(T): n = int(input()) array=[] for _ in range(2): array.append(list(map(int, input().split()))) dp=[[0]*n for _ in range(2)] dp[0][0],..
www.acmicpc.net/problem/1912 1912번: 연속합 첫째 줄에 정수 n(1 ≤ n ≤ 100,000)이 주어지고 둘째 줄에는 n개의 정수로 이루어진 수열이 주어진다. 수는 -1,000보다 크거나 같고, 1,000보다 작거나 같은 정수이다. www.acmicpc.net 1 2 3 4 5 6 7 8 N = int(input()) array=list(map(int, input().split())) d=[0]*N d[0]=array[0] for i in range(1,N): d[i]=max(d[i-1]+array[i], array[i]) print(max(d)) cs DP 문제. 연속 합을 저장하는 d 배열을 만들어서 각 배열을 순회할 때마다, 이전 연속 합+자기 값 vs 그냥 자기 값 해서..
www.acmicpc.net/problem/9019 9019번: DSLR 네 개의 명령어 D, S, L, R 을 이용하는 간단한 계산기가 있다. 이 계산기에는 레지스터가 하나 있는데, 이 레지스터에는 0 이상 10,000 미만의 십진수를 저장할 수 있다. 각 명령어는 이 레지스터에 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 from collections import deque def D(n): if n*2>9999: return (n*2)%10000 return n..