1 條題解

  • 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;
    }
    

    資訊

    ID
    1020
    時間
    1000ms
    記憶體
    256MiB
    難度
    5
    標籤
    (無)
    遞交數
    28
    已透過
    12
    上傳者