본문 바로가기

Coding Test/백준

[백준/자바] 2869 - 달팽이는 올라가고 싶다

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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int v = Integer.parseInt(st.nextToken());

        int temp = (v - a) / (a - b);
        if((v - a) % (a - b) != 0) temp += 2;
        else temp++;

        System.out.println(temp);

        br.close();
    }
}