QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#41442 | #4441. BIT Subway | L1ngYu | AC ✓ | 4ms | 5308kb | C++20 | 1.2kb | 2022-07-30 21:43:24 | 2022-07-30 21:43:26 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define forr(i,a) for(auto i:a)
#define rall(a) rbegin(a),rend(a)
#define all(a) begin(a),end(a)
#define pb emplace_back
using namespace std;
struct read
{
static const int M = 1 << 23;
char buf[M], *S = buf, *P = buf, c, l;
inline char gc() { return (S == P && (P = (S = buf) + fread(buf, 1, M, stdin), S == P) ? EOF : *S++); }
template<class T> read &operator>>(T &x)
{
for (c = 0;!isdigit(c);c = gc()) l = c;
for (x = 0;isdigit(c);c = gc()) x = x * 10 + (c & 15);
return x = (l ^ 45) ? x : -x, *this;
}
}Cin;
void solve()
{
double s1 = 0, s2 = 0;
int n; Cin >> n;
rep(i, 1, n)
{
int x; Cin >> x;
if (s1 < 100) s1 += x;
else if (s1 >= 100 && s1 < 200) s1 += x * 0.8;
else s1 += x * 0.5;
s2 += x;
}
if (s2 >= 100) s2 = 100 + (s2 - 100) * 0.8;
if (s2 >= 200) s2 = 200 + (s2 - 200) / 0.8 * 0.5;
cout << fixed << setprecision(3) << s2 << ' ' << s1 << '\n';
}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
int _;for (Cin >> _; _--; ) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 5308kb
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