zoukankan      html  css  js  c++  java
  • 2020年团体程序设计天梯赛 L1-5 胎压监测

    思路:

    水题,略过

    Tip:

    #include <bits/stdc++.h>
    
    using namespace std;
    
    int a[5];
    int di, yu, maxx;
    int indexx;
    
    int main() {
        bool flag1 = false;
        bool flag2 = false;
        for (int i = 1; i <= 4; i++) {
            cin >> a[i];
            maxx = max(maxx, a[i]);
        }
        cin >> di >> yu;
        for (int i = 1; i <= 4; i++) {
            if (a[i] < di || maxx - a[i] > yu) {
                if (flag2) {
                    flag1 = true;
                    break;
                } else {
                    flag2 = true;
                    indexx = i;
                }
            }
        }
        if (flag1) {
            cout << "Warning: please check all the tires!" << endl;
        } else if (flag2) {
            cout << "Warning: please check #" << indexx << "!" << endl;
        } else {
            cout << "Normal" << endl;
        }
        return 0;
    }
    

      

  • 相关阅读:
    第九周
    第七周.
    第六周.
    第二次作业
    第九周作业
    第八周作业
    第七周作业
    第六周作业
    第五周作业
    统计一行文本的单词个数
  • 原文地址:https://www.cnblogs.com/Whiteying/p/14056473.html
Copyright © 2011-2022 走看看