QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#136424#4196. Monty's HallRetiredButNotTired#AC ✓1ms3900kbC++17785b2023-08-08 18:48:232023-08-08 18:48:26

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-08 18:48:26]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3900kb
  • [2023-08-08 18:48:23]
  • Submitted

answer

// Hey there.. I love you <3
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

mt19937 rnd(time(nullptr));

const int N = 5e3 + 5, mod = 1e9 + 7;
const double pi = acos(-1);


void work() {
    
    int d, s, e;
    cin >> d >> s >> e;
    int out = d - s - e;
    double p = 1.0 / d, pOut = p * (d - s) / out;
    double ans = min(out, s) * pOut + max(0, s - out) * p;
    cout << fixed << setprecision(12) << ans << endl;
    
    
}


void init() {
    cin.tie(nullptr);
    istream::sync_with_stdio(false);
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);


}

int main() {
    init();
    
    int testCases = 1;
//    cin >> testCases;
    while (testCases--) work();
    
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3716kb

input:

3 1 1

output:

0.666666666667

result:

ok found '0.6666667', expected '0.6666670', error '0.0000003'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

8 4 2

output:

0.750000000000

result:

ok found '0.7500000', expected '0.7500000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

15 4 2

output:

0.325925925926

result:

ok found '0.3259259', expected '0.3259259', error '0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

1000000 1 1

output:

0.000001000001

result:

ok found '0.0000010', expected '0.0000010', error '0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

1000000 999998 1

output:

0.999999000000

result:

ok found '0.9999990', expected '0.9999990', error '0.0000000'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

1000000 1 999998

output:

0.999999000000

result:

ok found '0.9999990', expected '0.9999990', error '0.0000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

78 39 18

output:

0.730769230769

result:

ok found '0.7307692', expected '0.7307692', error '0.0000000'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

95 67 2

output:

0.726315789474

result:

ok found '0.7263158', expected '0.7263158', error '0.0000000'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

132 37 42

output:

0.502429959977

result:

ok found '0.5024300', expected '0.5024300', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

358 286 67

output:

0.986033519553

result:

ok found '0.9860335', expected '0.9860335', error '0.0000000'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

507 268 214

output:

0.950690335306

result:

ok found '0.9506903', expected '0.9506903', error '0.0000000'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

307521 21170 77603

output:

0.094432711641

result:

ok found '0.0944327', expected '0.0944327', error '0.0000000'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

801885 303025 80078

output:

0.450149783863

result:

ok found '0.4501498', expected '0.4501498', error '0.0000000'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

841840 457853 312238

output:

0.914771215433

result:

ok found '0.9147712', expected '0.9147712', error '0.0000000'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

141716 97110 2985

output:

0.706306980157

result:

ok found '0.7063070', expected '0.7063070', error '0.0000000'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

107479 105123 477

output:

0.982517515049

result:

ok found '0.9825175', expected '0.9825175', error '0.0000000'