QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227151#6801. Blackjackjzh#WA 980ms11892kbC++141.1kb2023-10-26 23:46:022023-10-26 23:46:02

Judging History

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

  • [2023-10-26 23:46:02]
  • 评测
  • 测评结果:WA
  • 用时:980ms
  • 内存:11892kb
  • [2023-10-26 23:46:02]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

using db = long double;

const int maxn = 505;
db dp[maxn][maxn], ndp[maxn][maxn];
int vec[maxn];

void solve() {
	int n, a, b; cin >> n >> a >> b;
	for(int i = 1 ; i <= n ; i ++) cin >> vec[i];

	dp[0][0] = 1;

	for(int i = 1 ; i <= n ; i ++) {
		memset(ndp, 0, sizeof(ndp));
		for(int x = 0 ; x <= i ; x ++) {
			for(int y = 0 ; y <= b ; y ++) {
				ndp[x][y] += dp[x][y];
				if(y+vec[i]<=b) ndp[x+1][y + vec[i]] += dp[x][y] * (x+1) / (n-x);
			}
		}
		memcpy(dp, ndp, sizeof(ndp));
	}

	db ans = 0;
	for(int i = 1 ; i <= n ; i ++) {
		memcpy(ndp, dp, sizeof(dp));
		for(int x = 0 ; x < n ; x ++) {
			for(int y = 0 ; y <= b ; y ++) {
				ndp[x+1][y+vec[i]] -= ndp[x][y] * (x+1) / (n-x);
			}
		}
		db temp = 0;
		for(int x = 0 ; x <= n-1 ; x ++) {
			for(int y = 0 ; y <= a ; y ++) {
				if(y+vec[i]>a and y+vec[i]<=b) {
					temp += ndp[x][y] / (n-x);
				}
			}
		}
		ans += temp;
	}
	cout << fixed << setprecision(100) << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	solve();

	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 5ms
memory: 11652kb

input:

5 2 4
1 1 1 5 5

output:

0.0999999999999999999945789891375724778299627359956502914428710937500000000000000000000000000000000000

result:

ok found '0.1000000', expected '0.1000000', error '0.0000000'

Test #2:

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

input:

5 2 4
1 1 1 3 5

output:

0.4500000000000000000162630325872825665101117920130491256713867187500000000000000000000000000000000000

result:

ok found '0.4500000', expected '0.4500000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 14ms
memory: 11836kb

input:

18 10 11
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

output:

0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.0000000', expected '-0.0000000', error '-0.0000000'

Test #4:

score: 0
Accepted
time: 11ms
memory: 11788kb

input:

14 15 16
3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #5:

score: 0
Accepted
time: 3ms
memory: 11788kb

input:

7 20 23
4 4 4 4 4 4 4

output:

0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #6:

score: 0
Accepted
time: 8ms
memory: 11792kb

input:

10 25 27
5 5 5 5 5 5 5 5 5 5

output:

0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #7:

score: 0
Accepted
time: 6ms
memory: 11780kb

input:

6 30 35
6 6 6 6 6 6

output:

0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #8:

score: 0
Accepted
time: 7ms
memory: 11836kb

input:

9 35 36
7 7 7 7 7 7 7 7 7

output:

0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.0000000', expected '-0.0000000', error '-0.0000000'

Test #9:

score: 0
Accepted
time: 12ms
memory: 11784kb

input:

14 33 40
8 8 8 8 8 8 8 8 8 8 8 8 8 8

output:

0.9999999999999999999457898913757247782996273599565029144287109375000000000000000000000000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 6ms
memory: 11848kb

input:

7 43 45
9 9 9 9 9 9 9

output:

0.9999999999999999998915797827514495565992547199130058288574218750000000000000000000000000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 6ms
memory: 11792kb

input:

7 49 50
10 10 10 10 10 10 10

output:

0.9999999999999999998915797827514495565992547199130058288574218750000000000000000000000000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #12:

score: 0
Accepted
time: 3ms
memory: 11892kb

input:

7 49 55
11 11 11 11 11 11 11

output:

0.9999999999999999998915797827514495565992547199130058288574218750000000000000000000000000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 13ms
memory: 11864kb

input:

16 53 60
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12

output:

1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 12ms
memory: 11792kb

input:

16 53 65
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13

output:

1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #15:

score: 0
Accepted
time: 5ms
memory: 11792kb

input:

10 55 60
8 2 8 10 8 8 1 2 8 10

output:

0.5638888888888888888876842198083494395177694968879222869873046875000000000000000000000000000000000000

result:

ok found '0.5638889', expected '0.5638889', error '0.0000000'

Test #16:

score: 0
Accepted
time: 6ms
memory: 11872kb

input:

10 38 43
5 8 1 9 7 2 1 9 3 1

output:

0.4888888888888888888172110785967916513072850648313760757446289062500000000000000000000000000000000000

result:

ok found '0.4888889', expected '0.4888889', error '0.0000000'

Test #17:

score: 0
Accepted
time: 4ms
memory: 11848kb

input:

10 49 52
8 2 8 10 6 2 10 5 1 5

output:

0.3861111111111111116977849533338229548462550155818462371826171875000000000000000000000000000000000000

result:

ok found '0.3861111', expected '0.3861111', error '0.0000000'

Test #18:

score: 0
Accepted
time: 4ms
memory: 11836kb

input:

10 44 49
3 10 3 2 7 5 5 10 5 4

output:

0.6777777777777777776235801354687282582744956016540527343750000000000000000000000000000000000000000000

result:

ok found '0.6777778', expected '0.6777778', error '0.0000000'

Test #19:

score: 0
Accepted
time: 4ms
memory: 11784kb

input:

10 54 58
5 9 8 2 4 3 8 7 7 6

output:

0.2999999999999999997940015872277541575385839678347110748291015625000000000000000000000000000000000000

result:

ok found '0.3000000', expected '0.3000000', error '0.0000000'

Test #20:

score: 0
Accepted
time: 8ms
memory: 11872kb

input:

10 46 49
2 2 3 9 9 3 4 5 7 7

output:

0.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok found '0.5000000', expected '0.5000000', error '0.0000000'

Test #21:

score: 0
Accepted
time: 8ms
memory: 11788kb

input:

10 50 51
10 9 10 4 8 2 1 1 2 10

output:

0.0575396825396825396631251495899173065140530525241047143936157226562500000000000000000000000000000000

result:

ok found '0.0575397', expected '0.0575397', error '0.0000000'

Test #22:

score: 0
Accepted
time: 8ms
memory: 11800kb

input:

10 35 39
8 6 4 1 3 1 9 6 2 3

output:

0.5888888888888888884323193073644375772346393205225467681884765625000000000000000000000000000000000000

result:

ok found '0.5888889', expected '0.5888889', error '0.0000000'

Test #23:

score: 0
Accepted
time: 9ms
memory: 11832kb

input:

10 62 64
10 8 7 4 4 7 10 10 8 1

output:

0.0444444444444444447582607399249710056210460606962442398071289062500000000000000000000000000000000000

result:

ok found '0.0444444', expected '0.0444444', error '0.0000000'

Test #24:

score: 0
Accepted
time: 9ms
memory: 11852kb

input:

10 40 41
2 2 2 4 6 4 4 6 5 10

output:

0.3666666666666666664570542466528024760918924584984779357910156250000000000000000000000000000000000000

result:

ok found '0.3666667', expected '0.3666667', error '0.0000000'

Test #25:

score: -100
Wrong Answer
time: 980ms
memory: 11884kb

input:

500 392 500
21 90 87 268 118 213 27 34 32 41 186 21 116 237 110 219 115 117 118 407 298 123 111 170 273 451 273 206 122 333 249 85 53 414 254 71 305 2 287 370 440 397 158 471 406 425 161 200 355 338 44 421 27 132 236 439 428 353 22 125 269 208 373 130 213 272 403 203 60 127 378 126 383 417 320 439 9...

output:

1449718791446.0682499408721923828125000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

wrong answer 1st numbers differ - expected: '0.4703331', found: '1449718791446.0683594', error = '1449718791445.5981445'