Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

전공공부

[BOJ 23971] ZOAC4 본문

Study/Problem Solving

[BOJ 23971] ZOAC4

monitor 2023. 7. 22. 17:23

n + 1, m+1 만큼 자리를 띄워서 앉아야 하므로 덧샘을 진행하고 H,W에 대해서 크기를 거기서 나눈 만큼이 남는 크기가 되는데 n+1,m+1로 만들었을때 사각형 외의 부분에도 실제로 사람이 앉을 수 있으므로 Math.ceil을 통해서 남는 자리는 반올림 해버린다.

 

 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class BOJ_23971_ZOAC4 {
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tk = new StringTokenizer(in.readLine()," ");
        double H = Integer.parseInt(tk.nextToken());
        double W = Integer.parseInt(tk.nextToken());
        double N = Integer.parseInt(tk.nextToken());
        double M = Integer.parseInt(tk.nextToken());
        int h = (int) (Math.ceil(H/(N+1)));
        int w = (int) (Math.ceil(W/(M+1)));

        System.out.println(h*w);

    }

}

'Study > Problem Solving' 카테고리의 다른 글

[BOJ 2292] 벌집  (0) 2023.07.24
[BOJ 5073] 삼각형과 세 변  (0) 2023.07.23
[PROGRAMMERS] 숫자 변환하기  (0) 2023.05.01
[PROGRAMMERS] 요격 시스템  (0) 2023.04.30
[PROGRAMMERS]연속된 부분 수열의 합  (0) 2023.04.14