QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#113132#4441. BIT SubwayLiuf#AC ✓22ms4608kbC++201.1kb2023-06-16 15:01:472023-06-16 15:02:01

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-16 15:02:01]
  • 评测
  • 测评结果:AC
  • 用时:22ms
  • 内存:4608kb
  • [2023-06-16 15:01:47]
  • 提交

answer

#include<bits/stdc++.h>

#define endl '\n'
#define pii pair<int, int>
#define int long long
#define ld long double

using namespace std;

const int mod=1e9+7,M=2000010,Mlog=22;

void solve(){
    cout<<fixed<<setprecision(3);

    int n;
    cin>>n;

    vector<int>a(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }

    ld ans=0,res=0,cur=0;
    int sum=0;
    for(int i=1;i<=n;i++){
        sum+=a[i];
    }

    if(sum>=100){
        if(sum>=100+100/0.8){
            ans=100+100+(sum-100-100/0.8)*0.5;
        } else{
            ans=100+(sum-100)*0.8;
        }
    } else{
        ans=sum;
    }

    for(int i=1;i<=n;i++){
        if(cur>=200){
            res+=a[i]*0.5;
            cur+=a[i]*0.5;
        } else if(cur>=100){
            res+=a[i]*0.8;
            cur+=a[i]*0.8;
        } else{
            res+=a[i];
            cur+=a[i];
        }
    }

    cout<<ans<<' '<<res<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin>>t;

    while(t--){
        solve();
    }



    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 22ms
memory: 4608kb

input:

10
10
20 50 105 200 11 31 88 177 30 122
12
75 200 65 200 200 1 2 3 4 5 6 10
10
95 5 125 200 10 20 70 60 55 7
10
99 126 70 10 32 22 200 199 20 77
10000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

504.500 564.500
473.000 523.000
411.000 411.000
515.000 540.000
5087.500 5087.500
1023956.500 1023962.900
1022476.500 1022481.000
5014830.000 5014855.000
5011888.500 5011908.000
5018160.500 5018176.300

result:

ok 10 lines