전체 글
-
[백준] 11047번 : 동전 0 - 자바(JAVA)알고리즘/백준 2022. 2. 28. 00:01
https://www.acmicpc.net/problem/11047 11047번: 동전 0 첫째 줄에 N과 K가 주어진다. (1 ≤ N ≤ 10, 1 ≤ K ≤ 100,000,000) 둘째 줄부터 N개의 줄에 동전의 가치 Ai가 오름차순으로 주어진다. (1 ≤ Ai ≤ 1,000,000, A1 = 1, i ≥ 2인 경우에 Ai는 Ai-1의 배수) www.acmicpc.net 문제 해석 준규는 동전을 많이 가지고 있는데 동전의 종류는 총 N이다. 동전을 적절히 사용하여 그 가치의 합을 K로 만드려고 한다. 이때 필요한 동전의 개수의 최솟값을 구하라. 입력 첫째 줄에 N과 K가 주어진다. 둘째 줄부터 N개의 줄에 동전의 가치 Ai가 오름차순으로 주어진다. 제약조건 1 ≤ N ≤ 10 1 ≤ K ≤ 100,0..
-
[Java] 자바의 인자 전달 방식 (call by value와 call by reference)Java 2022. 2. 27. 00:01
우선 call by value와 call by reference에 대해 먼저 설명해 드리겠습니다. Call-By-Value (값에 의한 호출) package javastudy; public class callByValueTest { public static void main(String[] args) { int x = 3; int y = 5; System.out.println(x + " " + y); swap(3,5); System.out.println(x + " " + y); } static void swap(int x, int y) { int temp = x; x = y; y = temp; } } 위의 코드의 출력 결과는 어떻게 될까요? 첫 번째 줄에는 당연히 3 5가 출력됩니다. swap이라는 메서..
-
[Java] 이클립스 글자 안 보일 때 해결 방법(이클립스 흰 화면 출력 시 해결 방법)Java 2022. 2. 26. 00:01
갑자기 잘되던 이클립스가 아래와 같이 아무것도 보이지 않고 엄청나게 큰 커서만 깜빡거리는 상황이 발생하였습니다. 오류 사진 첨부 우선 우클릭을 눌러 Preferences로 들어가 우측 상단에 font를 검색하여 Colors and Fonts로 이동합니다. Aa라는 이미지 옆에 공백이 있습니다. Use System Font를 사용하게 되면 다음과 같이 공백이 글자로 바뀌게 됩니다. 이후에 Apply and Close를 누르게 되면 글자가 잘 출력됩니다.
-
[백준] 7576번 : 토마토알고리즘/백준 2022. 2. 25. 10:05
https://www.acmicpc.net/problem/7576 7576번: 토마토 첫 줄에는 상자의 크기를 나타내는 두 정수 M,N이 주어진다. M은 상자의 가로 칸의 수, N은 상자의 세로 칸의 수를 나타낸다. 단, 2 ≤ M,N ≤ 1,000 이다. 둘째 줄부터는 하나의 상자에 저장된 토마토 www.acmicpc.net 문제 해석 N * M 크기의 창고에 토마토가 존재합니다. 창고는 익은 토마토, 익지 않은 토마토 , 빈 공간으로 이루어집니다. 익은 토마토는 4방향(상, 하, 좌, 우)으로 익지 않은 토마토에게 영향을 주며 하루가 지나면 토마토를 익게 만듭니다. 며칠이 지나면 토마토가 다 익는지 최소 일수를 알고 싶어 합니다. 처음부터 토마토가 모두 익어있다면 0을 출력하고, 토마토가 모두 익지 ..
-
[백준] 2531번 : 회전 초밥 - 자바(JAVA)알고리즘/백준 2022. 2. 25. 00:01
https://www.acmicpc.net/problem/2531 2531번: 회전 초밥 첫 번째 줄에는 회전 초밥 벨트에 놓인 접시의 수 N, 초밥의 가짓수 d, 연속해서 먹는 접시의 수 k, 쿠폰 번호 c가 각각 하나의 빈 칸을 사이에 두고 주어진다. 단, 2 ≤ N ≤ 30,000, 2 ≤ d ≤ 3,000, 2 ≤ www.acmicpc.net 문제 해석 회전 초밥 음식점의 회전하는 벨트 위에 여러 가지 종류의 초밥이 접시에 담겨 있다. 초밥의 종류를 번호로 표현하며, 벨트 위에는 같은 종류의 초밥이 둘 이상 있을 수 있다. 초밥집에는 행사가 존재한다. 1. 회전 벨트의 한 위치부터 k개의 접시를 연속해서 먹을 경우 할인된 정액 가격을 제공한다. 2. 각 고객에게 초반의 종류 하나가 쓰인 쿠폰을 발..
-
1940. 가랏! RC카!알고리즘/SW Expert Academy 2022. 2. 24. 17:14
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PjMgaALgDFAUq SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제 해석 RC카의 속도를 증가, 감소, 유지 시키며 N초동안 이동한 거리를 계산하면 됩니다. 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Solution_1940_가라RC카 { static..
-
2805. 농작물 수확하기 - 자바(JAVA)알고리즘/SW Expert Academy 2022. 2. 24. 00:01
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV7GLXqKAWYDFAXB SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제 해석 N x N 크기의 농장이 있다. 농장에는 규칙이 존재한다. 1. 농장의 크기는 항상 홀수이다. 2. 수확은 항상 농장의 크기에 딱 맞는 정사각형 마름모 형태로만 가능하다. 입력 가장 첫 줄에는 테스트 케이스의 개수 T가 주어지고, 그 아래로 각 테스트 케이스가 주어진다. 각 테스트 케이스에는 농장의 크기 N과 농장 내 농작물의 가치가 주어진다. 제약조건 농장의 크기 1
-
2001. 파리 퇴치 - 자바(JAVA)알고리즘/SW Expert Academy 2022. 2. 23. 00:01
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PzOCKAigDFAUq SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 문제 해석 N x N 배열 안의 숫자는 해당 영역에 존재하는 파리의 개수를 의미한다. M x M 크기의 파리채를 한 번 내려쳐 최대한 많은 파리를 죽이고자 할 때 죽은 파리의 개수를 구하라 예를 들어 M=2이고, N = 5인 경우의 정답은 49이다. 입력 가장 첫 줄에는 테스트 케이스의 개수 T가 주어지고, 그 아래로 각 테스트 케이스 주어진다. 각 테스트 케이스의 첫번째 줄에 N과 M이 주어집니다..