분류 전체보기
-
[JAVA] 백준 15684 사다리 조작알고리즘 공부/문제 풀이 2021. 10. 27. 12:10
https://www.acmicpc.net/problem/15684 15684번: 사다리 조작 사다리 게임은 N개의 세로선과 M개의 가로선으로 이루어져 있다. 인접한 세로선 사이에는 가로선을 놓을 수 있는데, 각각의 세로선마다 가로선을 놓을 수 있는 위치의 개수는 H이고, 모든 세로선 www.acmicpc.net 풀이 후기 - 인덱스 처리가 힘들었다. 원래는 사다리 크기에 딱 맞는 배열을 생성하여 범위 체크해가며 풀이했는데 코드가 복잡해져서 좌우로 마진을 한칸씩 주고, 범위 체크 없이 좌우에 사다리가 있는지 없는지를 확인했다 - 나는 boolean 배열로 해당 칸에 사다리가 있다 없다를 체크했는데, 다른 코드를 보니 오른쪽으로 뻗은 사다리는 1로 왼쪽으로 뻗은 사다리는 -1로 한 코드가 많았다. 더 직관..
-
[JAVA] 백준 21610 마법사 상어와 비바라기알고리즘 공부/문제 풀이 2021. 10. 26. 20:19
https://www.acmicpc.net/problem/21610 21610번: 마법사 상어와 비바라기 마법사 상어는 파이어볼, 토네이도, 파이어스톰, 물복사버그 마법을 할 수 있다. 오늘 새로 배운 마법은 비바라기이다. 비바라기를 시전하면 하늘에 비구름을 만들 수 있다. 오늘은 비바라기 www.acmicpc.net import java.util.*; import java.io.*; public class Main { public static class Pos{ int row, col; public Pos(int r, int c){ row = r; col = c; } } public static void main(String[] args) throws Exception { BufferedReader b..
-
[Spring] 회원가입 구현하기졸업프로젝트 2021. 10. 25. 15:14
로그인부터 하려고 했으나, Access Token Refresh Token 방식으로 구현하는 것이 막막하게 느껴져서 일단 순한맛 회원가입 먼저 해보려고 한다. DB 일단 USERS 테이블을 만든다. create table USERS ( user_id varchar(30) not null primary key, pw char(40) not null, name varchar(10) not null, email varchar(30) not null, profile varchar(50) ); Spring UserDto.java package com.hyomin.memomeet.model; public class UserDto { private String user_id; private String pw; pri..
-
[Spring] Connection Pool로 DB 연결하기졸업프로젝트 2021. 10. 24. 20:37
Connection Pool을 왜 사용하는지, 이론, 개념에 대한 블로그 [Spring] 커넥션 풀(Connection pool)이란? 커넥션 풀(Connection pool)에 대해서 그래도 알고 사용하자. 쉽게 알고 갔으면 좋겠습니다. linked2ev.github.io 매 요청마다 드라이버를 로드해서 커넥션을 연결하는 과정이 오래걸리니, 미리 만들어두고 (pool을 만든다) 관리하는 것. 무조건 좋은 것은 아님, 사용자가 너무 많이 몰려 자원이 부족해질 수 있기 때문에 적절한 자원을 만들어 두는 것이 중요하고 또한 너무 많이 만들어 놓으면 그만큼 자원 소모가 커지기 때문에 적절히 잘 조절하는 것이 중요! - 데이터베이스 연동을 위한 jdbc - dataSource를 사용하기 위한 dbcp depen..
-
[Spring] Spring과 React 연동하기졸업프로젝트 2021. 10. 24. 00:41
이 글은 개발된 프론트엔드를 가지고 서버를 재개발하는 프로젝트에 관한 글.. 로그인 페이지 가져오기 원래 프로젝트 때도 개발새발 하긴 했는데, 분명 4개월 전까지만 해도 돌아가던 프로젝트가 왜 안 돌아 가는 것인가.. 일단 로그인 페이지 복붙하고, route 설정해줬다. 안 됐던 부분이 페이지들을 모아놓은 pages 폴더에 상대 경로로 접근이 안됐던 것인데 Module not found: Can't resolve './pages' node_modules, package-lock 파일을 지우고 다시 npm install 하면 된다는 글이 있는데 안 고쳐져서.. 일단 import 폴더명을 './pages/Home'으로 수정하여 고침 그랬더니 다음 에러 등장 Attempted import error: 'Hom..
-
[Spring] 프로젝트 시작하기졸업프로젝트 2021. 10. 23. 21:43
nodeJS로 웹 서버 백엔드로 참여했던 졸업 프로젝트를 spring으로 바꿔보려 한다. 클라이언트 단은 이미 만들었던 거 사용하고, 최대한 실서비스를 개발한다는 생각으로 만들어보자! 1. github 레포지터리 만들기 일단은 private로 만들었다. 완전 기본 레포로 만들었음 (readme, gitignore 나중에 추가할 거임) 원하는 위치에서 git clone 후 작업 폴더 만들기 2. vsCode에서 npm 프로젝트 생성하기 (참고한 블로그, 자세하게 설명되어있어 좋았다!) https://m.blog.naver.com/rudnfskf2/222148407272 React + Springboot 게시판 만들기 1 : React 프로젝트 생성 및 개발 환경설정 배경 회사에서 리엑트로 구성된 어플리케이..
-
[JAVA] 백준 1766 문제집알고리즘 공부/문제 풀이 2021. 10. 23. 16:02
https://www.acmicpc.net/problem/1766 1766번: 문제집 첫째 줄에 문제의 수 N(1 ≤ N ≤ 32,000)과 먼저 푸는 것이 좋은 문제에 대한 정보의 개수 M(1 ≤ M ≤ 100,000)이 주어진다. 둘째 줄부터 M개의 줄에 걸쳐 두 정수의 순서쌍 A,B가 빈칸을 사이에 두고 주 www.acmicpc.net 풀이 후기 - 처음에 dfs로 풀이하려 했더니 해결 전략에 있는 반례가 존재했다 - 그림을 그려보니 진입 차수가 0인 노드들에 대해 우선순위로 뽑으며 순서를 정하면 되겠다 싶어서 정석 위상 정렬 풀이로 바꿨다 import java.util.*; import java.io.*; public class Main { public static void main(String[..
-
[JAVA] 백준 13334 철로알고리즘 공부/문제 풀이 2021. 10. 22. 14:04
https://www.acmicpc.net/problem/13334 13334번: 철로 입력은 표준입력을 사용한다. 첫 번째 줄에 사람 수를 나타내는 양의 정수 n (1 ≤ n ≤ 100,000)이 주어진다. 다음 n개의 각 줄에 정수 쌍 (hi, oi)가 주어진다. 여기서 hi와 oi는 −100,000,000이상, 100,000,0 www.acmicpc.net 이런 문제는 항상 오름차순 정렬을 하고 봐야하는 것 같다. 정렬한 후에 주어진 선분을 정보의 왼쪽이나 오른쪽 끝 값에 대보며 개수를 구하고, 반대쪽에서 정답 만족하는지 체크 이 문제 같은 경우는 오른쪽에 선분을 맞춰 이동시키며 왼쪽에서 정답 만족하지 않는 출근길들 빼내기 아래 블로그가 굉장히 설명이 잘 되어있다. https://chanhuiseo..