QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55000 | #2964. Loot Chest | T3alaadl3k2olyehymn3k# | WA | 2ms | 3932kb | C++ | 941b | 2022-10-11 21:18:28 | 2022-10-11 21:18:31 |
Judging History
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'