https://www.acmicpc.net/problem/6763
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 the following table:
<script>
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int speed_limit, recorded_speed;
scanf("%d", &speed_limit);
scanf("%d", &recorded_speed);
int over_limit = recorded_speed - speed_limit;
// 과속한 속도를 측정하기 위해 측정된 속도 - 속도 제한을 over_limit 변수에 담는다.
if (over_limit >= 31) { // 과속한 속도가 31 이상, 21이상, 1이상으로 구분한다.
printf("You are speeding and your fine is $500.");
}
else if (over_limit >= 21) {
printf("You are speeding and your fine is $270.");
}
else if (over_limit >= 1) {
printf("You are speeding and your fine is $100.");
}
else { // 과속하지 않았을 경우
printf("Congratulations, you are within the speed limit!");
}
return 0;
}
</script>