[백준] 2869번 : 달팽이는 올라가고 싶다 - Java(자바)

강재원·2022년 10월 17일
0

[코딩테스트] Java

목록 보기
120/200



https://www.acmicpc.net/problem/2869

import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner s= new Scanner(System.in);
        int a=s.nextInt();
        int b=s.nextInt();
        int v=s.nextInt();
        int k=(v-b)/(a-b);
        int m=(v-b)%(a-b);
        if(m==0) System.out.format("%d",k);
        else System.out.format("%d",k+1);
    }
}
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글