QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#54994 | #2964. Loot Chest | abdelrahman001# | WA | 435ms | 177232kb | C++ | 941b | 2022-10-11 21:06:30 | 2022-10-11 21:06:33 |
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][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: 422ms
memory: 177208kb
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: 56ms
memory: 177176kb
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: 435ms
memory: 177232kb
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: 356ms
memory: 177208kb
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: 397ms
memory: 177160kb
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: 429ms
memory: 177200kb
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: 406ms
memory: 177188kb
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: 363ms
memory: 177212kb
input:
1 2 1 99
output:
14526.200430604
result:
wrong answer 1st numbers differ - expected: '14648.6536176', found: '14526.2004306', error = '0.0083593'