https://www.acmicpc.net/problem/2869
2869번: 달팽이는 올라가고 싶다
첫째 줄에 세 정수 A, B, V가 공백으로 구분되어서 주어진다. (1 ≤ B < A ≤ V ≤ 1,000,000,000)
www.acmicpc.net
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
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()) - B;
int AB = A - B;
System.out.print((V / AB) + (V % AB != 0 ? 1 : 0));
}
}
'OJ' 카테고리의 다른 글
[BOJ] 18870 좌표 압축 (JAVA) (0) | 2023.08.04 |
---|---|
[BOJ] 2630 색종이 만들기 (JAVA) (0) | 2023.08.03 |
[BOJ] 2231 분해합 (JAVA) (0) | 2023.08.01 |
[BOJ] 9613 GCD 합 (JAVA) (0) | 2023.07.31 |
[BOJ] 25706 자전거 묘기 (JAVA) (0) | 2023.07.30 |