QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#60399#4441. BIT Subwayqinjianbin#AC ✓35ms4152kbC++17780b2022-11-04 13:18:012022-11-04 13:18:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-04 13:18:02]
  • 评测
  • 测评结果:AC
  • 用时:35ms
  • 内存:4152kb
  • [2022-11-04 13:18:01]
  • 提交

answer

#include<iostream>
using namespace std;

const int MAXN = 1e5 + 10;

int T, n;
int a[MAXN];
int sum;

int main() {
	scanf("%d", &T);
	while (T--) {
		scanf("%d", &n);
		sum = 0;
		for (int i = 1; i <= n; i++) 
			scanf("%d", &a[i]), sum += a[i];
		double ans1 = 0, ans2 = 0;
		if (sum <= 100) {
			ans1 = sum;
		}
		else if (sum <= 225) {
			ans1 = 100 + (sum - 100) * 0.8;
		}
		else {
			ans1 = 200 + (sum - 225) * 0.5;
		}
		double cur = 0;
		for (int i = 1; i <= n; i++) {
			if (cur < 100) {
				ans2 += a[i];
				cur += a[i];
			}
			else if (cur < 200) {
				ans2 += a[i] * 0.8;
				cur += a[i] * 0.8;
			}
			else {
				ans2 += a[i] * 0.5;
				cur += a[i] * 0.5;
			}
		}
		printf("%.3lf %.3lf\n", ans1, ans2);

	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 35ms
memory: 4152kb

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