QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#147907#4196. Monty's HallFangYifanAC ✓1ms3832kbC++14607b2023-08-23 14:40:142023-08-25 01:53:32

Judging History

你现在查看的是最新测评结果

  • [2023-08-25 01:53:32]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3832kb
  • [2023-08-23 14:40:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
constexpr int mod = 998244353;
constexpr int N = 2e5 + 10;

void solve() {
    db d, s, e;
    cin >> d >> s >> e;
    db ans = 0;
    for (int i = 0; i <= min(s, d - s - e); i++) {
        db res = (s - i) / d + (d - s) / d * i / (d - s - e);
        ans = max(ans, res);
    }
    cout << fixed << setprecision(15) << ans << "\n";
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    // cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

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

input:

3 1 1

output:

0.666666666666667

result:

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

Test #2:

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

input:

8 4 2

output:

0.750000000000000

result:

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

Test #3:

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

input:

15 4 2

output:

0.325925925925926

result:

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

Test #4:

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

input:

1000000 1 1

output:

0.000001000001000

result:

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

Test #5:

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

input:

1000000 999998 1

output:

0.999999000000000

result:

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

Test #6:

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

input:

1000000 1 999998

output:

0.999999000000000

result:

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

Test #7:

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

input:

78 39 18

output:

0.730769230769231

result:

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

Test #8:

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

input:

95 67 2

output:

0.726315789473684

result:

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

Test #9:

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

input:

132 37 42

output:

0.502429959977130

result:

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

Test #10:

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

input:

358 286 67

output:

0.986033519553073

result:

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

Test #11:

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

input:

507 268 214

output:

0.950690335305720

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.094432711641056

result:

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

Test #13:

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

input:

801885 303025 80078

output:

0.450149783862813

result:

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

Test #14:

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

input:

841840 457853 312238

output:

0.914771215432861

result:

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

Test #15:

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

input:

141716 97110 2985

output:

0.706306980157498

result:

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

Test #16:

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

input:

107479 105123 477

output:

0.982517515049452

result:

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