QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#55037 | #2964. Loot Chest | abdelrahman001 | WA | 426ms | 183568kb | C++ | 1.0kb | 2022-10-12 01:49:09 | 2022-10-12 01:49:11 |
Judging History
answer
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 2e5 + 5;
double dl, dw, g, l;
double memo[N][101];
double solve(int day, int p) {
if(day == N)
return 0;
double &ans = memo[day][p];
if(ans != -1)
return ans;
double win = (100 - l) / (double)100;
double lose = l / (double)100;
double wp = (double)p / (ld)100;
double lp = ((double)100 - (double)p) / (double)100;
ans = solve(day + 1, min((double)100, p + dl)) * lose;
ans += solve(day + 1, min((double)100, p + dw)) * win * lp;
ans += wp * win * ((g * day / 100) + solve(day + 1, 0) * (100 - g) / 100);
return ans;
}
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> dl >> dw >> g >> l;
for(int i = 0;i < N;i++) {
for(int j = 0;j <= 100;j++)
memo[i][j] = -1;
}
cout << fixed << setprecision(9) << solve(1, 0);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 377ms
memory: 183436kb
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: 55ms
memory: 183568kb
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: 388ms
memory: 183544kb
input:
1 100 10 0
output:
20.000000000
result:
ok found '20.0000000', expected '20.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 349ms
memory: 183460kb
input:
2 3 10 80
output:
197.005706720
result:
ok found '197.0057067', expected '197.0057067', error '0.0000000'
Test #5:
score: 0
Accepted
time: 371ms
memory: 183468kb
input:
1 1 100 0
output:
13.209960630
result:
ok found '13.2099606', expected '13.2099606', error '0.0000000'
Test #6:
score: 0
Accepted
time: 374ms
memory: 183440kb
input:
1 100 100 0
output:
2.000000000
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 386ms
memory: 183472kb
input:
1 1 1 0
output:
1320.996063022
result:
ok found '1320.9960630', expected '1320.9960630', error '0.0000000'
Test #8:
score: -100
Wrong Answer
time: 426ms
memory: 183464kb
input:
1 2 1 99
output:
14648.409192761
result:
wrong answer 1st numbers differ - expected: '14648.6536176', found: '14648.4091928', error = '0.0000167'