본문 바로가기

전체 글

(26)
5장 CPU Schedule
[백준][DP][9465]스티커 URL : https://www.acmicpc.net/problem/9465 - 소스코드 public class Main { public static void main(String[] args) throws FileNotFoundException { //Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(new FileInputStream("input.txt")); int cases = sc.nextInt(); int[][] answerArr; int N; int[][] arr; while(cases-- > 0){ N=sc.nextInt(); arr=new int[2][N]; for(int i=0; i
[백준][DP][2011] 암호코드 - URL : https://www.acmicpc.net/problem/2011 - 소스코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static int mod = 1000000; public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); int length = ..
[백준][DP][2193] 이친수 URL : https://www.acmicpc.net/problem/2193 - 소스코드 · 2차원 다이나믹 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[][] dp = new long[n+1][2]; // 이친수는 0으로 시작하지 않는다. dp[1][1] = 1; for(int i=2; i d[i-2] for (int i=3; i
[백준][DP][11057] 오르막 수 URL : https://www.acmicpc.net/problem/11057 - 소스코드 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] dp = new int[n+1][10]; for(int i=0; i
[백준][DP][10844] 쉬운 계단 수 URL : https://www.acmicpc.net/problem/10844 - 소스코드 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[][] dp = new int[n+1][10]; for(int i=1; i
[백준][DP][11726] 2 x n 타일링 URL : https://www.acmicpc.net/problem/11726 소스코드 : public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] dp = new int[n+1]; dp[0] = 1; dp[1] = 1; for(int i=3; i
[알고스팟][완전탐색] 보글 게임 URL : https://algospot.com/judge/problem/read/BOGGLE 알고스팟에 보글 게임이라는 문제가 있다. 하지만 해당 문제는 주어진 조건 때문에 완전탐색으로는 풀 수 없다. 하지만 지금은 완전 탐색의 공부를 목적으로 문제를 푸는 것이기 때문에 완전 탐색으로 문제를 접근하겠다. - 소스코드 static char[][] map = new char[5][5]; static final int[] dx = {-1, -1, -1, 1, 1, 1, 0, 0}; static final int[] dy = {-1, 0, 1, -1, 0, 1, -1, 1}; //5 x 5 보글 게임 판의 해당 위치에서 주어진 단어가 시작하는지를 반환. static boolean hasWord(int y, i..