yukicoder No.46 はじめのn歩

Problem

No.46 はじめのn歩 - yukicoder

Solution

Code

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
        String[] line = reader.readLine().split(" ");
        int a = Integer.parseInt(line[0]);
        int b = Integer.parseInt(line[1]);
        System.out.println((b+a-1)/a);
        
    }
}

Etc

a/bの時、(a+b-1)/bとすれば切り上げ。

Remove all ads