백준_14501 퇴사 (DP)
Algorithm/Algorithm 문제2024. 4. 13. 21:11백준_14501 퇴사 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_14501_퇴사 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] t = new int[n + 1]; int[] p = new int[n + 1]; int[] result = ne..

백준_1463 1로 만들기 (DP)
Algorithm/Algorithm 문제2024. 4. 11. 11:41백준_1463 1로 만들기 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_1463_1로만들기 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] d = new int[n+1]; d[1] = 0; for (int i=2; i

백준_1947 선물 전달 (조합 순열)
Algorithm/Algorithm 문제2024. 4. 8. 20:14백준_1947 선물 전달 (조합 순열)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_1947_선물전달 { static long t = 1000000000; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long[] d = new long[n+2]; //n=1 또는 2일 경우 아래 두줄에서 인덱스 에러. 따라서 n+2를 해줌 d[1] ..

백준_1256 사전 (조합 순열)
Algorithm/Algorithm 문제2024. 4. 8. 02:14백준_1256 사전 (조합 순열)

거의 4시간 들여다본 문제.. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_1256_사전 { public static void main(String[] args) throws IOException { StringBuilder result = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLi..

백준_1722 순열의 순서 (조합 순열)
Algorithm/Algorithm 문제2024. 4. 6. 20:43백준_1722 순열의 순서 (조합 순열)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_1722_순열의순서 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); boolean[] visited = new boolean[21]; //방문 배열 초기화 long[] f = new lon..

백준_13251 조약돌 꺼내기
Algorithm/Algorithm 문제2024. 4. 1. 21:54백준_13251 조약돌 꺼내기

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_13251_조약돌꺼내기 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int m = Integer.parseInt(br.readLine()); int[] rock = new int[m]; int i; int total = 0; StringTokenizer st..

백준_1010 다리 놓기
Algorithm/Algorithm 문제2024. 4. 1. 21:53백준_1010 다리 놓기

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_1010_다리놓기 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); int[][] d= new int[31][31]; int i; for (i=1; i

백준_2775 부녀회장이 될테야 (조합)
Algorithm/Algorithm 문제2024. 3. 28. 14:33백준_2775 부녀회장이 될테야 (조합)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_2775_부녀회장이될테야 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); int [][] d = new int[15][15]; int i; for (i=0; i

백준_11051 이항 계수 2 (조합)
Algorithm/Algorithm 문제2024. 3. 26. 23:10백준_11051 이항 계수 2 (조합)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_11051_이항계수2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int n = Integer.parseInt(st.nextToken()); int..

백준_11050 이항 계수 1 (조합)
Algorithm/Algorithm 문제2024. 3. 24. 17:04백준_11050 이항 계수 1 (조합)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_11050_이항계수1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int n = Integer.parseInt(st.nextToken()); int..

image