happy coding
[java] 2869. 달팽이는 올라가고 싶다. 본문
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] input = br.readLine().split(" ");
long A = Long.parseLong(input[0]);
long B = Long.parseLong(input[1]);
long V = Long.parseLong(input[2]);
long count = 1; // 초기값을 1로 설정
V -= A; // 첫 날은 이미 올라갔다고 가정
if (V > 0) {
long perDay = A - B;
long daysNeeded = (V + perDay - 1) / perDay; // 올라가야 할 총 날짜 계산
count += daysNeeded;
}
bw.write(Long.toString(count));
bw.flush();
bw.close();
}
}
'coding study > baekjoon' 카테고리의 다른 글
[java] 1157. 단어 공부 (0) | 2023.08.13 |
---|---|
[java] 4344. 평균은 넘겠지 (0) | 2023.08.13 |
[java] 2609. 최대공약수와 최소공배수 (0) | 2023.08.13 |
[java] 1546. 평균 (0) | 2023.08.13 |
[java] 10798. 세로 읽기 (0) | 2023.08.12 |
Comments