QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#533156#4441. BIT Subwayxuzhihaodedie#AC ✓20ms6512kbC++201003b2024-08-25 17:55:542024-08-25 17:55:54

Judging History

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

  • [2024-08-25 17:55:54]
  • 评测
  • 测评结果:AC
  • 用时:20ms
  • 内存:6512kb
  • [2024-08-25 17:55:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int,int>
#define lson 2*p
#define rson 2*p+1
#define x first
#define y second
const int N=5e5+10;
const int mod=1e9+7;
int a[N];
void solve() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    double ans=0,res=0;
    for(int i=1;i<=n;i++) {
        if(ans>=200) {
            ans+=a[i]*0.5;
            continue;
        }
        for(int j=1;j<=a[i];j++) {
            if(ans>=100&&ans<200) ans+=0.8;
            else if(ans>=200) ans+=0.5;
            else ans++; 
        }
    }
    printf("%.3lf ",ans);
    ans=0;
    for(int i=1;i<=n;i++) {
        if(ans>=100&&ans<200) {
            ans+=a[i]*0.8;
        } else if(ans>=200) {
            ans+=a[i]*0.5;
        } else {
            ans+=a[i];
        }
    }
    printf("%.3lf\n",ans);
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T=1;
	cin>>T;
	while(T--) {
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 20ms
memory: 6512kb

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