Study📚/백준

[백준] - #2869: 달팽이는 올라가고 싶다

woo!na 2024. 6. 3. 16:36

문제 출처 : https://www.acmicpc.net/

 


#2869: 달팽이는 올라가고 싶다 (언어 : Java11)


제출 답안

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 stk = new StringTokenizer(br.readLine());
		int a = Integer.parseInt(stk.nextToken());
		int b = Integer.parseInt(stk.nextToken());
		int v = Integer.parseInt(stk.nextToken());
		
		int date = (int)(Math.ceil((v-a)/((a-b)*1.0)));
		System.out.println(date+1);
	}
}

comment

- 엉금엉금 정석대로 하면 시간초과라구요~

'Study📚 > 백준' 카테고리의 다른 글

[백준] - #25083: 새싹  (0) 2024.06.04
[백준] - #11718: 그대로 출력하기  (0) 2024.06.04
[백준] - #25304: 영수증  (0) 2024.06.03
[백준] - #2751: 수 정렬하기 2  (0) 2024.06.03
[백준] - #10828: 스택  (0) 2024.06.02