목록문제 (388)
sm 기술 블로그
import java.util.*; import java.io.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); ArrayList[] triangle = new ArrayList[N]; for (int i = 0; i < N; i++) { triangle[i] = new ArrayList(); } for (int i = 0; i < N; i++) { String[] tmp = br.readLine().split(" "..
import sys input = sys.stdin.readline N = int(input()) triangle = [list(map(int,input().split())) for _ in range(N)] sum = 0 result = [] for i in range(1,N): for j in range(0,i+1): if(i == 1): triangle[i][j] += triangle[0][0] continue if(j == 0): triangle[i][j] += triangle[i-1][0] continue if(j == i): triangle[i][j] += triangle[i-1][j-1] continue triangle[i][j] += max(triangle[i-1][j-1],triangle..
import java.util.*; import java.io.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[][] num = new int[N][3]; for (int i = 0; i < N; i++) { String[] tmp = br.readLine().split(" "); num[i][0] = Integer.parseInt(tmp[0]); num[i][1] = Integer.parseInt(tmp[1..
import sys input = sys.stdin.readline N = int(input()) housePaintingCost = [list(map(int,input().split())) for _ in range(N)] for i in range(1, N): housePaintingCost[i][0] += min(housePaintingCost[i-1][1],housePaintingCost[i-1][2]) housePaintingCost[i][1] += min(housePaintingCost[i-1][0],housePaintingCost[i-1][2]) housePaintingCost[i][2] += min(housePaintingCost[i-1][0],housePaintingCost[i-1][1]..