2869번 달팽이는 올라가고 싶다.

2020. 2. 3. 14:47Learn/Algorithm

1
2
3
4
5
6
7
8
9
10
11
12
13
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double A = sc.nextInt();
        double B = sc.nextInt();
        double V = sc.nextInt();
        
        double value = (V - A) / (A - B);
        int va = (intMath.ceil(value);
        
        System.out.println(va + 1);
    }
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

그냥 오를수 있는 값을 최대 가지길이에 뺀뒤에 값을

하루에 올라가고 미끄러진 값을 나눈 값을 올림 해준뒤 1을 더하면 끝.

 

'Learn > Algorithm' 카테고리의 다른 글

14720 우유축제  (0) 2020.02.03
1003번 피보나치 함수  (0) 2020.02.03
2447 별찍기 -10  (0) 2020.02.02
11053 백준 가장 긴 증가하는 부분수열  (0) 2020.02.02
552 : 반복제어문3 - 자가진단5  (0) 2020.01.31