QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55011 | #2964. Loot Chest | abdelrahman001# | WA | 546ms | 177368kb | C++ | 1003b | 2022-10-11 21:43:44 | 2022-10-11 21:43:45 |
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 = 1e5 + 5;
ld dl, dw, g, l;
ld memo[N][101];
ld solve(int day, int p) {
if(day == N)
return 0;
ld &ans = memo[day][p];
if(ans != -1)
return ans;
ld win = (100 - l) / (ld)100;
ld lose = l / (ld)100;
ld wp = (ld)p / (ld)100;
ld lp = ((ld)100 - (ld)p) / (ld)100;
ans = solve(day + 1, min((ld)100, p + dl)) * lose;
ans += solve(day + 1, min((ld)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;
}
详细
Test #1:
score: 100
Accepted
time: 534ms
memory: 177216kb
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: 76ms
memory: 177160kb
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: 526ms
memory: 177220kb
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: 335ms
memory: 177088kb
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: 546ms
memory: 177212kb
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: 537ms
memory: 177164kb
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: 542ms
memory: 177368kb
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: 375ms
memory: 177224kb
input:
1 2 1 99
output:
14526.200430604
result:
wrong answer 1st numbers differ - expected: '14648.6536176', found: '14526.2004306', error = '0.0083593'