백준 #6763번 Speed fines are not fine!

jhj·2024년 2월 9일

백준 JAVA

목록 보기
174/583
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();
		
		if(a >= b) {
			System.out.println("Congratulations, you are within the speed limit!");
		}else {
			if(1 <= b - a && b - a <= 20) {
				System.out.println("You are speeding and your fine is $100.");
			}else if(21 <= b - a && b - a <= 30) {
				System.out.println("You are speeding and your fine is $270.");
			}else if(31 <= b - a) {
				System.out.println("You are speeding and your fine is $500.");
			}
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글