PS_Baekjoon

[백준 C++] 6763번 : Speed fines are not fine!

SMILELY 2023. 4. 28. 23:25

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

 

6763번: Speed fines are not fine!

Many communities now have “radar” signs that tell drivers what their speed is, in the hope that they will slow down. You will output a message for a “radar” sign. The message will display information to a driver based on his/her speed according to

www.acmicpc.net

코드 :

#include <iostream>
#include <algorithm>
using namespace std;

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