Input
Input to this problem will consist of a single data set. The data set will be formatted according to the following description.
The data set will consist of a single line containing 3 numbers, separated by single spaces. Each number represents the height of a single underpass in inches. Each number will be between 0 and 300 inclusive.
The data set will consist of a single line containing 3 numbers, separated by single spaces. Each number represents the height of a single underpass in inches. Each number will be between 0 and 300 inclusive.
Output
There will be exactly one line of output. This line will be:
NO CRASH
if the height of the 18-wheeler is less than the height of each of the underpasses, or:
CRASH X
otherwise, where X is the height of the first underpass in the data set that the 18-wheeler is unable to go under (which means its height is less than or equal to the height of the 18-wheeler).
The height of the 18-wheeler is 168 inches.
NO CRASH
if the height of the 18-wheeler is less than the height of each of the underpasses, or:
CRASH X
otherwise, where X is the height of the first underpass in the data set that the 18-wheeler is unable to go under (which means its height is less than or equal to the height of the 18-wheeler).
The height of the 18-wheeler is 168 inches.
大意:输入三个不大于300的数,如果大于168,则输出 CRASH X,如果没有小于168的数,则输出NO CRASH
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cmath>
#include<iomanip>
//#define P 3.141592653
using namespace std;
void main()
{
int x, y, z;
cin >> x >> y >> z;
if (x <= 300 && y <= 300 && z <= 300)
if (x<168)
cout << "CRASH " << x<< endl;
else if (y<168)
cout << "CRASH " << y << endl;
else if (z<168)
cout << "CRASH " << z << endl;
else
cout << "NO CRASH" << endl;
system("pause");
}