https://www.acmicpc.net/problem/2869
문제 풀이
낮 동안 목적지에 도착했을 경우를 생각해서 B미터를 빼 주지 않아도 된다.
코드
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));
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 dayMove=A-B;
int destination=V-B;
// 최종 목적지
if(destination%dayMove!=0) {
bw.write(String.valueOf(destination/dayMove+1));
}else {
// 나누어 떨어지면 낮에 도착
bw.write(String.valueOf(destination/dayMove));
}
bw.flush();
bw.close();
}
}
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준_1764/JAVA] 듣보잡 (0) | 2025.03.06 |
---|---|
[백준_2775/JAVA] 부녀회장이 될테야 (0) | 2025.03.05 |
[백준_18870/JAVA] 좌표 압축 (0) | 2025.02.27 |
[백준_2346/JAVA] 풍선 터트리기 (0) | 2025.02.06 |
[백준_12789/JAVA] 도키도키 간식드리미 (1) | 2025.01.28 |