QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#54588 | #4196. Monty's Hall | Username# | AC ✓ | 2ms | 3928kb | C++ | 1.2kb | 2022-10-09 19:44:27 | 2022-10-09 19:44:31 |
Judging History
answer
#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("popcnt,abm,mmx,avx2")
#endif
#include <bits/stdc++.h>
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
#define rep(i, l, r) for (int i = l; i < r; ++i)
using Long = long long;
using Double = double;
using vi = vector<int>;
template <class U, class V>
istream& operator>>(istream& is, pair<U, V>& p) {
is >> p.first >> p.second;
return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
for (auto& x : v) {
is >> x;
}
return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
for (auto& x : v) {
os << x << " ";
}
return os;
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#else
#define endl '\n'
#endif
int d, s, e;
cin >> d >> s >> e;
int o = d - s - e;
double p1 = 1.0 / d;
double p2 = 1.0 * (d - s) / d / o;
double res = min(o, s) * p2 + (s - min(o, s)) * p1;
cout << fixed << setprecision(10) << res << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3748kb
input:
3 1 1
output:
0.6666666667
result:
ok found '0.6666667', expected '0.6666670', error '0.0000003'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3760kb
input:
8 4 2
output:
0.7500000000
result:
ok found '0.7500000', expected '0.7500000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3788kb
input:
15 4 2
output:
0.3259259259
result:
ok found '0.3259259', expected '0.3259259', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1000000 1 1
output:
0.0000010000
result:
ok found '0.0000010', expected '0.0000010', error '0.0000000'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3856kb
input:
1000000 999998 1
output:
0.9999990000
result:
ok found '0.9999990', expected '0.9999990', error '0.0000000'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
1000000 1 999998
output:
0.9999990000
result:
ok found '0.9999990', expected '0.9999990', error '0.0000000'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3856kb
input:
78 39 18
output:
0.7307692308
result:
ok found '0.7307692', expected '0.7307692', error '0.0000000'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
95 67 2
output:
0.7263157895
result:
ok found '0.7263158', expected '0.7263158', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
132 37 42
output:
0.5024299600
result:
ok found '0.5024300', expected '0.5024300', error '0.0000000'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3716kb
input:
358 286 67
output:
0.9860335196
result:
ok found '0.9860335', expected '0.9860335', error '0.0000000'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3788kb
input:
507 268 214
output:
0.9506903353
result:
ok found '0.9506903', expected '0.9506903', error '0.0000000'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
307521 21170 77603
output:
0.0944327116
result:
ok found '0.0944327', expected '0.0944327', error '0.0000000'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
801885 303025 80078
output:
0.4501497839
result:
ok found '0.4501498', expected '0.4501498', error '0.0000000'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
841840 457853 312238
output:
0.9147712154
result:
ok found '0.9147712', expected '0.9147712', error '0.0000000'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
141716 97110 2985
output:
0.7063069802
result:
ok found '0.7063070', expected '0.7063070', error '0.0000000'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3732kb
input:
107479 105123 477
output:
0.9825175150
result:
ok found '0.9825175', expected '0.9825175', error '0.0000000'