L1-069 胎壓監測 分數 15

Frodnx發表於2024-08-16
// 15'0"
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int arr[6], flag[6];
    int total = 0;
    int m = 0;  // max
    for(int i = 0; i < 6; ++ i)
    {
    	cin >> arr[i];
        flag[i] = false;
    	m = max(m, arr[i]);
	}
    for(int i = 0; i < 4; ++ i)
        if(arr[i] < arr[4] || m - arr[i] > arr[5]) flag[i] = true, ++ total;
    if(total == 0) cout << "Normal" << endl;
    else if(total == 1)
    {
        for(int i = 0; i < 4; ++ i)
        	if(flag[i] == true) cout << "Warning: please check #" << i + 1 << "!" << endl;
	}
    else cout << "Warning: please check all the tires!" << endl;
    return 0;
}

相關文章