L1-069 胎壓監測

YuKiCheng發表於2024-03-29

easy.

#include <bits/stdc++.h>
using namespace std; 
set<pair<int, int>> st;
int maxv = 0;
int main() {
	for(int i=1;i<=4;i++){
		int t;
		cin >> t;
		st.insert({ t,i });
		maxv = max(maxv, t);
	}
	int cmp,subv;
	cin >> cmp >> subv;
	int flag = 0;
	for (auto x : st) {
		if (maxv - x.first > subv || x.first < cmp) {
			if (flag == 0) flag = x.second;
			else {
				printf("Warning: please check all the tires!");
				return 0;
			}
		}
	}
	if (flag) {
		printf("Warning: please check #%d!", flag);
	}
	else {
		printf("Normal");
	}
	return 0;
}

相關文章