QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#132367#5127. Crashing Competition ComputerYaremaWA 3ms3804kbC++17919b2023-07-29 18:02:302023-07-29 18:02:31

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-29 18:02:31]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3804kb
  • [2023-07-29 18:02:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FILL(a, b) memset(a, b, sizeof(a))

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

const int INF = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int c, t, r;
	cin >> c >> t >> r;
	double p;
	cin >> p;
	
	vector<double> dp(c + 1);
	dp[0] = 0;
	FOR (i, 1, c + 1)
	{
		dp[i] = (dp[i - 1] + 1 + r * p) / (1 - p);
	}
	vector<double> dp2(c + 1, INF);
	dp2[0] = 0;
	FOR (i, 1, c + 1)
	{
		FOR (j, 0, i)
		{
			dp2[i] = min(dp2[i], dp2[j] + dp[i - j] + t);
		}
	}
	cout << fixed << setprecision(10) << dp2[c] << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

input:

2 1 5
0.25

output:

8.0000000000

result:

ok found '8.0000000', expected '8.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

3 5 2
0.5

output:

26.0000000000

result:

ok found '26.0000000', expected '26.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

10 4 5
0.327

output:

68.6649673569

result:

ok found '68.6649674', expected '68.6649674', error '0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

1 0 0
0.0010000000

output:

1.0010010010

result:

ok found '1.0010010', expected '1.0010010', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 3ms
memory: 3804kb

input:

2000 1000000000 1000000000
0.9990000000

output:

1000000007.0000000000

result:

wrong answer 1st numbers differ - expected: '2000000001999999.7500000', found: '1000000007.0000000', error = '0.9999995'