알고리즘/백준

백준 1712 손익분기점 자바

reumiii 2019. 10. 28. 22:45
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int result = 0;

		// result * c > a + b * result
		// (c-b) * result > a
		// result > a / (c-b)

		if (b >= c) { // 한대를 팔때마다 지출이 수입보다 크면 -> 손익분기점이 존재하지 않음
			result = -1;
		} else {
			result = a / (c - b) + 1;
		}

		System.out.println(result);
    }
}