본문 바로가기
알고리즘/백준

백준 1712 손익분기점 자바

by reumiii 2019. 10. 28.
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);
    }
}

'알고리즘 > 백준' 카테고리의 다른 글

백준 1193 분수 찾기 자바  (0) 2019.10.31
백준 2292 벌집 자바  (0) 2019.10.30
백준 2839 설탕 배달 자바  (0) 2019.10.29
백준 1316 그룹 단어 체커 자바  (0) 2019.10.24
백준 2941 크로아티아 알파벳 자바  (0) 2019.10.23

댓글