QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#185360 | #4196. Monty's Hall | ckiseki | AC ✓ | 0ms | 3880kb | C++23 | 1.2kb | 2023-09-21 21:53:21 | 2023-09-21 21:53:22 |
Judging History
answer
#include <bits/stdc++.h>
#ifdef local
#define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
#define debug(args...) qqbx(#args, args)
#define orange(args...) danb(#args, args)
using std::cerr;
template <typename ...T> void qqbx(const char *s, T ...args) {
int cnt = sizeof...(T);
((cerr << "\e[1;32m(" << s << ") = ("), ..., (cerr << args << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I> void danb(const char *s, I L, I R) {
cerr << "\e[1;32m[ " << s << " ] = [ ";
for (int f = 0; L != R; ++L) cerr << (f++ ? ", " : "") << *L;
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) ((void)0)
#define orange(...) ((void)0)
#endif // local
#define all(v) begin(v),end(v)
using namespace std;
using llf = long double;
signed main() {
cin.tie(nullptr) -> sync_with_stdio(false);
llf d, s, e;
cin >> d >> s >> e;
// d - e - s
llf x = min(d - e - s, s);
llf A = s / d * ((s - x) / s);
llf B = (1 - s / d) * x / (d - e - s);
cout << fixed << setprecision(20);
// llf P = s / d * (d - s);
// llf Q = (1 - s / d) * (d - s - e);
// debug(A, B);
// debug(P, Q);
// llf ans = (A * P + B * Q) / (P + Q);
// debug(ans);
cout << A + B << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
3 1 1
output:
0.66666666666666666663
result:
ok found '0.6666667', expected '0.6666670', error '0.0000003'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
8 4 2
output:
0.75000000000000000000
result:
ok found '0.7500000', expected '0.7500000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
15 4 2
output:
0.32592592592592592592
result:
ok found '0.3259259', expected '0.3259259', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1000000 1 1
output:
0.00000100000100000200
result:
ok found '0.0000010', expected '0.0000010', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
1000000 999998 1
output:
0.99999900000000000003
result:
ok found '0.9999990', expected '0.9999990', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
1000000 1 999998
output:
0.99999899999999999998
result:
ok found '0.9999990', expected '0.9999990', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
78 39 18
output:
0.73076923076923076925
result:
ok found '0.7307692', expected '0.7307692', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
95 67 2
output:
0.72631578947368421052
result:
ok found '0.7263158', expected '0.7263158', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
132 37 42
output:
0.50242995997712978847
result:
ok found '0.5024300', expected '0.5024300', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
358 286 67
output:
0.98603351955307262568
result:
ok found '0.9860335', expected '0.9860335', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
507 268 214
output:
0.95069033530571992108
result:
ok found '0.9506903', expected '0.9506903', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
307521 21170 77603
output:
0.09443271164105625484
result:
ok found '0.0944327', expected '0.0944327', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
801885 303025 80078
output:
0.45014978386281249997
result:
ok found '0.4501498', expected '0.4501498', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
841840 457853 312238
output:
0.91477121543286135132
result:
ok found '0.9147712', expected '0.9147712', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
141716 97110 2985
output:
0.70630698015749809480
result:
ok found '0.7063070', expected '0.7063070', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
107479 105123 477
output:
0.98251751504945152076
result:
ok found '0.9825175', expected '0.9825175', error '0.0000000'