Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- isNotEmpty
- 404error
- Python
- Linux
- IntelliJ
- iBatis
- 호이스팅
- error
- github
- 티스토리챌린지
- java
- docker
- DBMS
- 자바
- zset
- mysql
- git
- spring
- SQL
- 명령어
- 리눅스
- analytics4
- mssql
- PostgreSQL
- oracle
- datagrip
- Kibana
- pandas
- Javascript
- 오블완
Archives
- Today
- Total
hanker
백준(1712) JAVA - 손익분기점 본문
반응형
import java.util.Scanner;
public class Main {
public static void main(String ar[]) throws Exception{
Scanner sc = new Scanner(System.in);
// 고정비용
int A = sc.nextInt();
// 가변비용 (한 개당 비용)
int B = sc.nextInt();
// 판매 가
int C = sc.nextInt();
int cnt = 1;
// A + (B * ?) < C * ? → A < (C - B) * ?
if(B >= C) {
cnt = -1;
} else {
while(true) {
if(A < (C - B) * cnt) {
break;
} else {
cnt++;
}
}
}
System.out.println(cnt);
}
}
반응형
'Study > ALGORITHM' 카테고리의 다른 글
백준(1193) JAVA - 분수찾기 (0) | 2021.01.21 |
---|---|
백준(2292) JAVA - 벌집 (0) | 2021.01.15 |
백준(1316) JAVA - 그룹 단어 체커 (0) | 2021.01.07 |
백준(2941) JAVA - 크로아티아 알파벳 (0) | 2021.01.05 |
백준(5622) JAVA - 다이얼 (0) | 2021.01.05 |