알고리즘

[알고리즘] 백준 6763 - Speed fines are not fine! (C++)

blueberrysoda 2025. 2. 17. 21:31

[문제 링크] : https://www.acmicpc.net/problem/6763

#include <iostream>
using namespace std;

int A, B;

int main(){
    cin >> A >> B;
    int tmp = A - B;
    if(tmp >= 0){
        cout << "Congratulations, you are within the speed limit!\n";
    }
    else{
        cout << "You are speeding and your fine is $";
        if(1 <= -tmp && -tmp <= 20){
            cout << 100;
        }
        else if(21 <= -tmp && -tmp <= 30){
            cout << 270;
        }
        else if(-tmp >= 31){
            cout << 500;
        }
        cout << ".\n";
    }
    return 0;
}