알고리즘 공부/문제 풀이
-
[JAVA] 백준 17123 배열 놀이알고리즘 공부/문제 풀이 2021. 9. 22. 19:38
https://www.acmicpc.net/problem/17123 17123번: 배열 놀이 N개의 행과 N개의 열로 구성된 2차원 정수 배열 A가 있다. A[r, c]는 r번째 행 c번째 열에 위치한 원소의 값을 나타낸다. 이 배열에 총 M번의 연산을 적용하는 배열 놀이를 생각해보자. 각 연산에 대 www.acmicpc.net 풀이 코드 import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.p..
-
[JAVA] 백준 11062 카드 게임알고리즘 공부/문제 풀이 2021. 9. 19. 22:46
https://www.acmicpc.net/problem/11062 11062번: 카드 게임 근우와 명우는 재미있는 카드 게임을 하고 있다. N개의 카드가 일렬로 놓여 있다. 각 카드에는 점수가 적혀있다. 근우부터 시작하여 번갈아가면서 턴이 진행되는데 한 턴에는 가장 왼쪽에 있는 www.acmicpc.net 풀이 해결 전략은 문제를 풀며 적은 내용으로 실제 작성한 코드와 상이할 수 있습니다. 변경된 부분은 왜 변경했는지 풀이 후기에 적어 놓았으니 참고 바랍니다! 코드 import java.io.*; import java.util.*; public class Main { static int[][][] dp; static int[] arr; public static void main(String[] args..
-
[JAVA] SWEA 1767 프로세서 연결하기알고리즘 공부/문제 풀이 2021. 9. 18. 13:00
SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제는 위 링크와 풀이의 문제 분석을 참고해주세요. 풀이 해결 전략은 문제를 풀며 적은 내용으로 실제 작성한 코드와 상이할 수 있습니다. 변경된 부분은 왜 변경했는지 풀이 후기에 적어 놓았으니 참고 바랍니다! 코드 import java.util.*; import java.io.*; public class Solution { static int N, coreCnt; static int[][] MAP; static int answer = 10000, CON = 0; static ArrayList cores; static int[][] d = {{-1, 1, 0, 0}..
-
[JAVA] 백준 13460 구슬 탈출 2알고리즘 공부/문제 풀이 2021. 9. 17. 14:46
https://www.acmicpc.net/problem/13460 13460번: 구슬 탈출 2 첫 번째 줄에는 보드의 세로, 가로 크기를 의미하는 두 정수 N, M (3 ≤ N, M ≤ 10)이 주어진다. 다음 N개의 줄에 보드의 모양을 나타내는 길이 M의 문자열이 주어진다. 이 문자열은 '.', '#', 'O', 'R', 'B' www.acmicpc.net 풀이 해결 전략은 문제를 풀며 적은 내용으로 실제 작성한 코드와 상이할 수 있습니다. 변경된 부분은 왜 변경했는지 풀이 후기에 적어 놓았으니 참고 바랍니다! 코드 import java.util.*; public class Main { static int N, M; static char[][] map; static int[][] d = {{-1, 1..
-
[JAVA] 백준 17472 다리 만들기2알고리즘 공부/문제 풀이 2021. 9. 17. 10:59
https://www.acmicpc.net/problem/17472 17472번: 다리 만들기 2 첫째 줄에 지도의 세로 크기 N과 가로 크기 M이 주어진다. 둘째 줄부터 N개의 줄에 지도의 정보가 주어진다. 각 줄은 M개의 수로 이루어져 있으며, 수는 0 또는 1이다. 0은 바다, 1은 땅을 의미한다. www.acmicpc.net 문제의 설명은 링크와 문제 분석을 참고해주세요 풀이 해결 전략은 문제를 풀며 적은 내용으로 실제 작성한 코드와 상이할 수 있습니다. 변경된 부분은 왜 변경했는지 풀이 후기에 적어 놓았으니 참고 바랍니다! 코드 import java.util.*; import java.io.*; public class Main { static int N, M; static int[][] map;..
-
[JAVA] 백준 16235 나무 재테크알고리즘 공부/문제 풀이 2021. 9. 16. 23:06
https://www.acmicpc.net/problem/16235 16235번: 나무 재테크 부동산 투자로 억대의 돈을 번 상도는 최근 N×N 크기의 땅을 구매했다. 상도는 손쉬운 땅 관리를 위해 땅을 1×1 크기의 칸으로 나누어 놓았다. 각각의 칸은 (r, c)로 나타내며, r은 가장 위에서부터 www.acmicpc.net 풀이 노트 풀이 전략은 문제를 풀며 적은 내용으로 실제 작성한 코드와 상이할 수 있습니다. 변경된 부분은 왜 변경했는지 풀이 후기에 적어 놓았으니 참고 바랍니다! 코드 import java.util.*; import java.io.*; public class Main { public static class Tree implements Comparable{ int row, col, ..
-
[JAVA] 백준 9205 맥주 마시면서 걸어가기알고리즘 공부/문제 풀이 2021. 9. 16. 21:42
https://www.acmicpc.net/problem/9205 9205번: 맥주 마시면서 걸어가기 송도에 사는 상근이와 친구들은 송도에서 열리는 펜타포트 락 페스티벌에 가려고 한다. 올해는 맥주를 마시면서 걸어가기로 했다. 출발은 상근이네 집에서 하고, 맥주 한 박스를 들고 출발한다. www.acmicpc.net 풀이 코드 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; public class BOJ_9205_맥주마시면서걸어가기 { public static void main(String[] args) throws Exception { Buf..
-
[프로그래머스] 그래프 - 순위알고리즘 공부/문제 풀이 2020. 9. 1. 23:11
그래프의 개념보다는 set의 개념을 이용하여 문제를 풀었다.. 블로그 https://velog.io/@ajufresh/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%EC%88%9C%EC%9C%84-%EB%AC%B8%EC%A0%9C%ED%92%80%EC%9D%B4-Java [프로그래머스] 순위 문제풀이 (Java) [프로그래머스] 순위 문제풀이 (Java) velog.io 를 참고하여 코드는 내가 작성한 것이다. package algorithmStudy; import java.util.*; class Player{ Set win=new HashSet();//player한테 이긴사람 Set lose=new HashSet();//player 진사람 } pu..