QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#54998 | #2964. Loot Chest | abdelrahman001# | WA | 883ms | 350808kb | C++ | 941b | 2022-10-11 21:08:39 | 2022-10-11 21:08:42 |
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;
ld dl, dw, g, l;
ld memo[N][105];
ld solve(int day, int p) {
if(day == N)
return 0;
ld &ans = memo[day][p];
if(ans != -1)
return ans;
ans = solve(day + 1, min((ld)100, p + dl)) * l / 100;
ans += solve(day + 1, min((ld)100, p + dw)) * ((100 - l) / 100) * ((ld)(100 - p) / 100);
ans += ((ld)p / 100) * ((100 - l) / 100) * ((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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 850ms
memory: 350616kb
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: 120ms
memory: 350808kb
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: 849ms
memory: 350808kb
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: 725ms
memory: 350656kb
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: 832ms
memory: 350644kb
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: 883ms
memory: 350644kb
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: 814ms
memory: 350656kb
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: 718ms
memory: 350672kb
input:
1 2 1 99
output:
14648.409192765
result:
wrong answer 1st numbers differ - expected: '14648.6536176', found: '14648.4091928', error = '0.0000167'