QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#60399 | #4441. BIT Subway | qinjianbin# | AC ✓ | 35ms | 4152kb | C++17 | 780b | 2022-11-04 13:18:01 | 2022-11-04 13:18:02 |
Judging History
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;
}
詳細信息
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