1 条题解

  • 0
    @ 2026-6-9 19:08:17
    #include<bits/stdc++.h>
    using namespace std;
    
    int main() {
        int h1, h2, h3, h4;
        cin >> h1 >> h2 >> h3 >> h4;
        
        int L = h1;
        int D = h2;  
        if(abs(h3 - L) < abs(D - L) || 
           (abs(h3 - L) == abs(D - L) && h3 < D)) {
            D = h3;
        }
        if(abs(h4 - L) < abs(D - L) || 
           (abs(h4 - L) == abs(D - L) && h4 < D)) {
            D = h4;
        }
        
        cout << D << endl;
        return 0;
    }
    

    信息

    ID
    29254
    时间
    1000ms
    内存
    512MiB
    难度
    1
    标签
    递交数
    4
    已通过
    2
    上传者