按照规定,在高速公路上行使的机动车,超出本车道限速的10%则处200元罚款;若超出50%,就要吊销驾驶证。请编写程序根据车速和限速自动判别对该机动车的处理。
输入格式:
输入在一行中给出2个正整数,分别对应车速和限速,其间以空格分隔。
输出格式:
在一行中输出处理意见:若属于正常行驶,则输出“OK”;若应处罚款,则输出“Exceed x%. Ticket 200”;若应吊销驾驶证,则输出“Exceed x%. License Revoked”。其中x是超速的百分比,精确到整数。
输入样例1:65 60输出样例1:
OK输入样例2:
110 100输出样例2:
Exceed 10%. Ticket 200输入样例3:
200 120输出样例3:
Exceed 67%. License Revoked
<pre name="code" class="cpp">#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int speed1, speed2;
float x;
cin >> speed1 >> speed2;
x = (speed1 - speed2) / (float)speed2;
if (x < 0.1)
{
cout << "OK\n";
}
else if (x < 0.5)
{
cout << "Exceed " << setprecision(0) << fixed << x * 100 << "%. Ticket 200\n";
}
else
{
cout << "Exceed " << setprecision(0) << fixed << x * 100 << "%. License Revoked\n";
}
return 0;
}