1 solutions

  • 1
    @ 2026-5-31 11:29:01
    #include<bits/stdc++.h>
    using namespace std;
    double a[111110];
    int main()
    {
        int n;
        while(cin>>n)
        {
            double maxv=0,cnt=0;
            for(int i=1;i<=n;i++)
            {
                cin>>a[i];
                maxv=max(maxv,a[i]);
                cnt+=a[i];
            //    cout<<cnt<<endl;
            }
            cnt-=maxv;
           // cout<<cnt<<" "<<maxv<<endl;
            if(maxv>=cnt) 
            {
                cout<<fixed<<setprecision(1)<<cnt<<endl;
            } 
            else
            {
                double t=maxv+cnt;
                cout<<fixed<<setprecision(1)<<t/2<<endl;
            }
    
        }
        return 0;
    }
    

    Information

    ID
    1020
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    28
    Accepted
    12
    Uploaded By