Algorithm 문제풀이/simulation

[BOJ] 백준 5532- 방학숙제(JAVA)

cjsong 2019. 7. 28. 23:12

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
public class Main5532_방학숙제 {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int L = Integer.parseInt(br.readLine());
        int A = Integer.parseInt(br.readLine());
        int B = Integer.parseInt(br.readLine());
        int C = Integer.parseInt(br.readLine());
        int D = Integer.parseInt(br.readLine());
 
        int port = (A / C >= B / D) ? A / C : B / D;
 
        if (A % port == 0) {
            System.out.println(L - port);
            return;
        }else {
            System.out.println(L - (port+1));
        }
    }// end of main
}// end of class
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs