Algorithm

[백준-1712번/Java] 손익분기점

1984 2022. 11. 10. 14:09
import java.util.Scanner;

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();

		if (B >= C) {
			System.out.println(-1);
		} else if ((double) A / (C - B) + 1 > 1) {
			System.out.println(A / (C - B) + 1);
		}

		sc.close();
	}

}
728x90