We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main.java.com.poogle.BOJ.Q1149; import java.util.Scanner; public class Main { static int[][] d; static int[][] a; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); d = new int[n + 1][3]; a = new int[n + 1][3]; for (int i = 1; i <= n; i++) { for (int j = 0; j < 3; j++) { a[i][j] = sc.nextInt(); } } for (int i = 1; i <= n; i++) { d[i][0] = Math.min(d[i - 1][1], d[i - 1][2]) + a[i][0]; d[i][1] = Math.min(d[i - 1][0], d[i - 1][2]) + a[i][1]; d[i][2] = Math.min(d[i - 1][0], d[i - 1][1]) + a[i][2]; } System.out.println(Math.min(Math.min(d[n][0], d[n][1]), d[n][2])); } }
The text was updated successfully, but these errors were encountered:
d9dc0d3
코드 포맷팅
dc7d703
Issue #136
BOJ: 1149 풀이 수정
e8c8355
suhyunsim
No branches or pull requests
문제
핵심 아이디어
=> min(D[n][0], D[n][1], D[n][2])
어려운 점, 실수
풀이
The text was updated successfully, but these errors were encountered: