- spring mvc
- spring security 6
- 프로그래머스
- Docker
- nginx
- 1차원 배열
- 문자열
- jpa
- java
- 자바
- ORM
- select
- string
- Django
- spring
- DI
- join
- 스프링부트
- SSL
- 데이터베이스
- hibernate
- 스프링
- springboot
- mysql
- PYTHON
- spring boot
- static
- AWS
- @transactional
- sql
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
목록Algorithm (21)
개발하는 자몽
백준에서 DP의 기초 문제인 1463번을 풀어보았다. 1463번: 1로 만들기 첫째 줄에 1보다 크거나 같고, 106보다 작거나 같은 정수 N이 주어진다. www.acmicpc.net 문제 풀이 해당 문제를 보고 어떻게 DP로 풀어야겠다! 는 생각이 바로 들진 않았고, 처음에 그냥 무작정 반복문과 if-else의 조합으로 풀었다. 실패했다. if-else가 아닌 이유 if-else가 아닌 모든 경우의 연산을 시도하고 가장 작은 연산 횟수를 택해야 하기 때문에 모두 if로 행하고 Math.min으로 비교했을 때 가장 작은 값을 택한다. 동적 계획법으로 풀 수 있는 이유 여러 해설을 봤는데 가장 이해가 잘 되는 글은 아래 블로그였다. 백준 알고리즘 1463번 문제풀이 1로 만들기 문제 정수 X에 사용할 수 ..
문제 문제 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static boolean check(String str) { boolean word[] = new boolean[26]; int prev = 0; for (int i = 0; i < str.length(); i++) { int now = str.charAt(i); //앞선 문자와 i번째 문자가 같지 않은 경우 if (prev != now) { //해당 문자가 처음 나오는 경우 (false인 경우) if (!word[now - 'a']) { word[now - 'a'] = true; prev =..
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); int len = str.length(); int cnt = 0; for (int i = 0; i < len; i++) { char ch = str.charAt(i); if (ch == 'c' && i < le..
문제 코드 import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { //buffer와 switch-case를 사용한 방법 외 다른 방법 int cnt = 0; int input; while (true) { input = System.in.read(); if (input == '\n') break; if (input < 68) cnt += 3; else if (input < 71) cnt += 4; else if (input < 74) cnt += 5; else if (input < 77) cnt += 6; else if (input < 80) cnt += 7; else ..
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int a = Integer.parseInt(new StringBuilder(st.nex..
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); System.out.println(st.countTokens()); } }
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); int cnt[] = new int[26]; for (byte inputs : input.getBytes()) { if (inputs >= 97) { cnt[inputs - 'a']++; } else { c..
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int t = Integer.parseInt(br.readLine()); for (int i = 0; i < t; i++) { String[] str = br.readLine().split..
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String S = br.readLine(); int alphabet[] = new int[26]; for(int i=0; i< alphabet.length; i++){ alphabet[i] = -1; } for(int i=0; i
문제 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String numbers = br.readLine(); int sum = 0; for(int i=0; i