QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55000#2964. Loot ChestT3alaadl3k2olyehymn3k#WA 2ms3932kbC++941b2022-10-11 21:18:282022-10-11 21:18:31

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-11 21:18:31]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3932kb
  • [2022-10-11 21:18:28]
  • 提交

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")

#include "bits/stdc++.h"

#define int long long
#define rep(i, n) for(int (i)=0 ;(i)<n ;(i)++)
using namespace std;
const int N = 102;
double dp[N];
double deltaL, deltaW, probOfG, probofL, W;

double solve(int curProb) {
    if (curProb >= 99)return 1 / W;
    double &cur = dp[curProb];
    if (cur > -1)return cur;
    cur = 0;
    return cur = 1 + W * ((100 - curProb) / 100.0 * solve(curProb + deltaW)) + probofL * solve(curProb + deltaL);
}

signed main() {
    for (int i = 0; i < N; i++)
        dp[i] = -1;
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
    cin >> deltaL >> deltaW >> probOfG >> probofL;
    probofL /= 100;
    probOfG /= 100;
    W = 1 - probofL;
    cout << fixed << setprecision(9) << solve(0) / probOfG << endl;
}

详细

Test #1:

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

input:

1 100 50 0

output:

4.000000000

result:

ok found '4.0000000', expected '4.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3768kb

input:

50 50 100 25

output:

2.833333333

result:

ok found '2.8333333', expected '2.8333333', error '0.0000000'

Test #3:

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

input:

1 100 10 0

output:

20.000000000

result:

ok found '20.0000000', expected '20.0000000', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 2ms
memory: 3764kb

input:

2 3 10 80

output:

197.005354267

result:

wrong answer 1st numbers differ - expected: '197.0057067', found: '197.0053543', error = '0.0000018'