想法
这个题也是超简单的一个,和前面两个题一样,题目知道啥意思了,什么都好说。真没做对,肯定是题没读懂。
这个题还真卡了我一下,比赛的时候嘛,就是想赶紧做,就没认真读题,第一次写完,样例没对。然后又了看,才知道是啥意思
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int a[10] = {
0};
int maxt;
for (int i = 0; i < 6; i++)
{
cin >> a[i];
}
maxt = (*max_element(a, a + 4));
int f = 0;
int index;
for (int i = 0; i < 4; i++)
{
if (abs(a[i] - maxt) > a[5] || a[i] < a[4])
{
f++;
index = i + 1;
}
}
if (f == 1)
printf("Warning: please check #%d!", index);
else if (f >= 2)
printf("Warning: please check all the tires!");
else
cout << "Normal";
return 0;
}