• 문제 링크
13170번: 떨어진 수정
첫 번째 줄에 네 개의 정수 N, K, P, W가 주어진다. 이는 순서대로 남아있는 마나 수정의 수 N(1 ≤ N ≤ 1,000)과 마나가 응집된 마나 수정의 강도 순위를 나타내는 K(1 ≤ K ≤ N), 둔 망치의 최대 파워 P
www.acmicpc.net
• 풀이 코드
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
read();
read();
int p = read(), w = read();
bw.write(String.valueOf((p - 1) / w + 1));
bw.flush();
}
private static int read() throws IOException {
int c, n = System.in.read() & 15;
while ((c = System.in.read()) > 32) n = (n << 3) + (n << 1) + (c & 15);
return n;
}
}
'Problem Solving > Baekjoon' 카테고리의 다른 글
[백준] 14457 Cow Tipping - Greedy / Java (0) | 2023.10.23 |
---|---|
[백준] 23305 수강변경 - Greedy / Java (0) | 2023.10.22 |
[백준] 1417 국회의원 선거 - Greedy / Java (0) | 2023.10.20 |
[백준] 25943 양팔저울 - Greedy / Java (0) | 2023.10.19 |
[백준] 28256 초콜릿 보관함 - Graph Theory / Java (0) | 2023.10.18 |
댓글