当前位置:网站首页>L1-069 tire pressure monitoring (15 points)
L1-069 tire pressure monitoring (15 points)
2022-06-10 16:47:00 【Liabilities between persons^】
L1-069 Tire pressure monitoring (15 branch )
There is a system in the car to monitor the tire pressure of four wheels at any time , If the four tire pressures are not very balanced , It may have a serious impact on the driving .

Let's put four wheels —— Left front wheel 、 Right front wheel 、 Right rear wheel 、 Left rear wheel —— The serial number is 1、2、3、4. Please write a monitoring program , Monitor the tire pressure of the four wheels at any time , And give correct alarm information . The alarm rules are as follows :
- If the error between the pressure values of all tires and the maximum of them is within a given threshold , And the tire pressure shall not be lower than the minimum alarm tire pressure set by the system , It indicates that the situation is normal , Don't call the police ;
- If the error between the pressure value of a tire and the maximum value of them exceeds the threshold , Or lower than the minimum alarm tire pressure set by the system , Then you should not only call the police , And give the exact location of the tire that may leak ;
- If there are two or more tires, the error between the pressure value and the maximum value of them exceeds the threshold , Or lower than the minimum alarm tire pressure set by the system , The alarm requires all tires to be checked .
Input format :
Enter... On one line 6 individual [0, 400] Range of integers , In turn 1~4 The tire pressure of tire No 、 Minimum alarm tire pressure 、 And the threshold of tire pressure difference .
Output format :
The corresponding information is given according to the entered tire pressure value :
- If you don't have to call the police , Output
Normal; If a tire needs an alarm , OutputWarning: please check #X!, amongX - It's the number of the tyre in question ;
- Check all tires if necessary , Output
Warning: please check all the tires!.
sample input 1:
242 251 231 248 230 20
sample output 1:
Normal
sample input 2:
242 251 232 248 230 10
sample output 2:
Warning: please check #3!
sample input 3:
240 251 232 248 240 10
sample output 3:
Warning: please check all the tires!
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
typedef long long ll;
const int N=10010;
int main()
{
int a[4], x, y;
int maxx = 0;
for(int i = 0; i < 4; i ++ )
{
cin >> a[i];
maxx = max(a[i], maxx);
}
cin >> x >> y;
int flag = 0;
int res;
for(int i = 0; i < 4; i ++ )
{
if((maxx - a[i]) <= y && a[i] >= x)
continue;
else
{
flag ++ ;
res = i;
}
}
if(flag == 0) cout << "Normal" << endl;
else if(flag == 1) printf("Warning: please check #%d!", res + 1);
else cout << "Warning: please check all the tires!" << endl;
return 0;
}
边栏推荐
- How to own your own blog website from scratch [Huawei cloud to jianzhiyuan]
- NanoMQ Newsletter 2022-05|v0.8.0 发布,新增 WebHook 拓展接口和连接认证 API
- 卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程,進互聯大廠如此簡單
- Financial risk control practice - anomaly detection (I)
- Thinking and precipitation after docking with hundreds of third-party APIs
- Then, we will cooperate with impulse online and Feiteng to complete partner certification and jointly create a private computing ecosystem for Xinchuang
- Jerry's long press reset and high level reset [chapter]
- PV operation daily question - Restaurant Service
- 51 timer initial value calculation
- Why do I need a thread pool? What is pooling technology?
猜你喜欢

postman切换主题

Technology sharing | quick intercom, global intercom
![[quick code] define the new speed of intelligent transportation with low code](/img/cd/da8cf959200dba8eeab6c8eccc5635.jpg)
[quick code] define the new speed of intelligent transportation with low code

技术分享| 快对讲,全球对讲

PV operation daily question - single log bridge problem

Devops-3 cloud computing and cloud era operation and maintenance

Diagram of the quarterly report of station B: the revenue is RMB 5.1 billion, with a year-on-year increase of 30% and nearly 300million monthly active users

Why do I need a thread pool? What is pooling technology?

Webdypro layout control cannot be used_ SAP LIUMENG

Specific method of Modbus RTU communication between Velcro touch screen and delta inverter (picture and text)
随机推荐
Four Byron poems translated from heartless sword
MM主要的表和主要字段_SAP刘梦_
Financial risk control practice - anomaly detection (I)
Weilai quarterly report diagram: the revenue was 9.9 billion yuan, a year-on-year increase of 24%, and the operating loss was nearly 2.2 billion yuan
51 timer initial value calculation
PV operation daily question - exam questions
打造隐私计算领先方案 冲量在线数据互联平台获得鲲鹏Validated认证
Fiddler创建AutoResponder
Analysis report on marketing status and demand potential of China's acetate starch industry 2022-2028
嵌入式开发:使用MCU进行无线更新面临的5大挑战
When visual studio 2019 is installed, vs installer cannot download files. The progress bar is 0. It shows the solutions to network problems
Download and install pycharm integrated development environment [picture]
CAN总线协议基础
Common methods and selection principles of test cases
leetcode:730. Statistics of different palindrome subsequences [traversed by point and surface interval DP + 3D DP + diagonal]
Analysis of different dimensions of enterprise reviewers: enterprise growth of Hunan Great Wall Science and Technology Information Co., Ltd
Full array of arrays
Investment prospect and development strategy planning of China's waste power generation equipment industry 2022-2028 Edition
数字图像处理:灰度化
College entrance examination that year