본문 바로가기
아기 개발자/백준 문제풀이

[BOJ_JAVA] 백준 1712번 : 손익분기점 @달깅

by 달깅 2019. 11. 4.

 

 

https://www.acmicpc.net/problem/1712

 

누가 롱으로 해야된다길래 했다가 런타임 에러 떠서 그냥

인티저로 하니까 잘 되더라!

 

 


정답코드

 

 

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

댓글