알고리즘왕/BOJ

[백준/1712/JAVA] 손익분기점

찌 ㅋ 2020. 3. 18. 13:06

 

 

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;
		if(b>=c) result = -1;
		else result = a/(c-b) + 1;
		System.out.println(result);
	}
}

 

 


제목 보고 1차 당황 

내용 자체는 쉬워서 안심했다가 4번 틀려서 2차 당황 ㅠㅠ;;;;;;;;;;;;;;;;;;;

a+b*x < c*x인 경우에 x를 출력하도록 했었는데 외,, 툴렷을까,,,?

구글링 해서 겨우 풀었다 따흑

 

 

'알고리즘왕 > BOJ' 카테고리의 다른 글

[백준/2292/JAVA] 벌집  (0) 2020.03.18
[백준/2839/JAVA] 설탕 배달  (0) 2020.03.18
[백준/1316/JAVA] 그룹 단어 체커  (0) 2020.03.18
[백준/5622/JAVA] 다이얼  (0) 2020.03.18
[백준/2908/JAVA] 상수  (0) 2020.03.18