분류 전체보기
-
백준 2775번 : 부녀회장이 될테야알고리즘, SQL/알고리즘 2023. 12. 23. 23:54
https://www.acmicpc.net/problem/2775 2775번: 부녀회장이 될테야 첫 번째 줄에 Test case의 수 T가 주어진다. 그리고 각각의 케이스마다 입력으로 첫 번째 줄에 정수 k, 두 번째 줄에 정수 n이 주어진다 www.acmicpc.net 문제를 보면서 공식을 찾아보려고 메모장 켜서 일부를 그려보니까 공식따위는 존재하지 않는듯 했다. 층/호 1호 2호 3호 4호 5호 6호 5층 1 7 28 84 210 462 4층 1 6 21 56 126 252 3층 1 5 15 35 70 126 2층 1 4 10 20 35 56 1층 1 3 6 10 15 21 0층 1 2 3 4 5 6 그래서 머리 좀 굴리다가..사람들 풀이를 살짝 참고해보니, 제한란에 k와n에 해당하는 값이 1이상 1..
-
백준 2292번 : 벌집알고리즘, SQL/알고리즘 2023. 12. 22. 22:35
간단하게 가운데 벌집모양부터 시작해서 인접한 변에 하나씩 추가되는 육각형에, 입력되는 숫자가 간운데로부터 몇번째에 접해있는지 찾는 문제이다! 육각형 하나를 방(room)이라고 생각했을 때, 가운데 1번방과 접해있는 가장 큰 방이 7이다. 7번방과 접해있는 가장 큰 방은 19번, 19번과 접해있는 가장 큰 방은 37번... 즉 1, 7, 19, 37, 61로 6의 배수만큼 커지는 것을 알 수 있다. 코드를 생성해보면.. public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int num ..
-
@RequiredArgsConstructor 사용에러(Feat.eclipse)Java 2023. 12. 20. 22:45
전에 팀프로젝트를 리팩토링 과정 중 생성자를 따로 쓰지 않으면서 생성자를 통한 주입으로 바꿔주기 위해@RequiredArgsConstructor를 썼었다. 그런데, 자꾸 "The blank final field boardService may not have been initialized"컴파일 에러로 final을 초기화 시키라고 뜨길래 "eclipse에서는 못쓰나..?" 하면서 어쩔 수 없이 생성자를 남겨줬었다. 그리고 지금..새로 게시판을 만드는데, final 초기화 하라는 컴파일에러가 또 뜨길래 이번엔 왜 그러는지 자세히 좀 알아봤다. https://stackoverflow.com/questions/54489530/lombok-requiredargsconstructor-not-working-causi..
-
프로젝트 DB고르기프로젝트/게시판 2023. 12. 19. 22:59
새로운 프로젝트를 시작하려고 하는데 앞서, 우선 어떤 DB를 사용할지 고민을 해봤다. 우선 DB는 크게 RBDMS와 NoSQL로 나뉘는데, NoSQL에 대해서는 지난 포스팅에서 다뤘었다. https://hsch19.tistory.com/31 NoSQL이란 무엇인가? NoSQL이란? NoSQL은 사람에 따라 No SQL, Not Only SQL, Non-Relational Operational Database SQL로 엇갈리는 의견들이 있지만, 현재 Not Only SQL로 풀어 설명하는 것이 다수를 차지하고 있다. NoSQL은 비관계형 데이터베 hsch19.tistory.com 현재 만드려는 프로젝트는 우선 기본적인 웹 게시판을 만들어보고, 이후 주제를 정해서 점점 고도화를 시켜나가려고 한다. RDBMS..
-
쿠키(Cookie)란 무엇인가? (+ Session 추가정리)CS 2023. 12. 18. 23:57
서버가 클라이언 인증을 확인하는 방식에 대표적으로 쿠키, 세션, 토큰이 있다. 그중에 세션과 JWT 인증 방법에 대해 알아봤었는데, 세션과 JWT의 근간이 되는 쿠키에 대한 내용이 없고 둘의 차이점에만 집중하다보니, 내용이 너무 부족했던거 같다. 그래서 이번에 포스팅하면서 이전 내용을 보충하고 추가적으로 공부하고자 한다. https://hsch19.tistory.com/7 JWT와 Session 개요 이제까지 배웠던 로그인 방식은 세션에 저장하는 방식만 배웠기에 다른 인증 방법이 있는줄 몰랐는데, 세션 방식말고도 토큰 방식 인증인 JWT가 있다는 것을 알게 돼서 정리해보고자 한다. hsch19.tistory.com 지난 포스팅에서도 언급했었지만 HTTP는 비연결성(Connectionless)와 무상태성(..
-
이분 탐색/이진 탐색(Binary Search)이란? (+백준 1920번)알고리즘, SQL/알고리즘 2023. 12. 15. 23:57
개요 알고리즘 문제를 풀다보니 이진탐색과 관련된 문제이지만, 이진탐색이 아닌 다른 방향으로 풀었던 기억이 있다. 그래서 이번에 이진탐색에 대해 정리하면서 이진탐색 문제가 나왔을 때 바로 떠올릴 수 있도록 해보고자 한다! 이진/이분 탐색이란? 순차적 탐색(선형 탐색)보다 빠른 탐색을 위해 나온 탐색 방법으로 정렬된 배열에서 특정값을 찾는 알고리즘을 의미한다. 탐색범위를 절반으로 줄여나가기 때문에 순차적 탐색에 비해 빠른 속도를 보장한다. 이진 탐색 과정 순차적 탐색(선형 탐색) 정렬된 배열에서 특정 원소를 찾기위해 모든 순차적으로 모든 인덱스를 탐색한다. 이분 탐색 정렬된 배열 안에서 특정원소를 찾을 때 인덱스 LOW값과 HIGH의 중간값을 비교 중간값이 특정원소가 아니라면 중간 값과 비교 후 다시 인덱스..
-
NoSQL이란 무엇인가?CS 2023. 12. 14. 23:59
NoSQL이란? NoSQL은 사람에 따라 No SQL, Not Only SQL, Non-Relational Operational Database SQL로 엇갈리는 의견들이 있지만, 현재 Not Only SQL로 풀어 설명하는 것이 다수를 차지하고 있다. NoSQL은 비관계형 데이터베이스로, 관계형 데이터베이스 모델을 사용하지 않는 다양한 형태의 데이터베이스 시스템을 통칭하는 용어이다. NoSQL은 전통적인 관계형 데이터베이스 시스템과 다르게 데이터를 저장하고 처리하는 다양한 방식을 제공하며, 주로 대규모 데이터나 분산환경에서 유용하게 사용된다. NoSQL 특징 RDBMS에 비해 대용량 데이터를 저장한다. 분산형 구조를 통해 여러대의 서버에 분산하여 저장하고 상호 복제하여 데이터 유실이나 서비스 중지에 대..
-
백준 2751번 : 수 정렬하기2 (+System.out.println 반복사용의 단점)알고리즘, SQL/알고리즘 2023. 12. 13. 23:57
https://www.acmicpc.net/problem/2751 2751번: 수 정렬하기 2 첫째 줄에 수의 개수 N(1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄부터 N개의 줄에는 수가 주어진다. 이 수는 절댓값이 1,000,000보다 작거나 같은 정수이다. 수는 중복되지 않는다. www.acmicpc.net 풀이 입력받은 값을 오름차순으로 정렬해주면 되는 간단한 문제다. 리스트를 정렬하기 위해서 Collections.sort메서드를 활용해서 public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(..