QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54995#2964. Loot Chestabdelrahman001#TL 0ms0kbC++941b2022-10-11 21:07:142022-10-11 21:07:15

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-11 21:07:15]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2022-10-11 21:07:14]
  • 提交

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 = 5e5 + 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;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

1 100 50 0

output:


result: