UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#184862#2053. 地雷爆炸wuzr1005ms1356kbC++1.5kb2023-09-14 23:40:352023-09-14 23:40:35

answer

#include<bits/stdc++.h>
using namespace std;
#define y1 y114514
#define ll long long
#define ld long double
#define ui unsigned int
#define ull unsigned long long
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define per(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define vi vector<int>
#define pb push_back
#define eb emplace_back
#define vpii vector<pair<int,int>>
#define mk make_pair
#define MAX 0x7fffffff
#define popcount __builtin_popcountll
#define TIME 1e3*clock()/CLOCKS_PER_SEC
#define ckmax(x,y) x=x<y?y:x
#define ckmin(x,y) x=x<y?x:y
inline ll rd() {
	ll x = 0, flag = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = (x << 3) + (x << 1) + (ch ^ 48);
		ch = getchar();
	}
	return x * flag;
}
inline void wr(ll x) {
	if (x < 0) putchar('-'), x = -x;
	if (x > 9) wr(x / 10);
	putchar(x % 10 + '0');
}
bool Mbe;

double dp[305], p[305];
int n, m;

bool Med;
signed main() {
	fprintf(stderr, "%.3lf MB\n", (&Mbe - &Med) / 1048576.0);
	//ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	cin >> n >> m;
	rep(i, 0, n - 1) cin >> p[i];
	rep(i, 1, m) rep(j, 0, n - 1) dp[i] += p[j] * pow(dp[i - 1], j);
	printf("%.4f", dp[m]);

	return cerr << "Time: " << TIME << " ms\n", 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 1ms
memory: 1356kb

input:

300 20
0.00379430 0.00378180 0.00857190 0.00919620 0.00396670 0.00176760 0.00511380 0.00793840 0.005...

output:

0.0038

result:

ok single line: '0.0038'

Test #2:

score: 10
Accepted
time: 1ms
memory: 1352kb

input:

300 69
0.03642550 0.00870610 0.00174390 0.00728740 0.00917590 0.00276320 0.00788090 0.00688300 0.000...

output:

0.0367

result:

ok single line: '0.0367'

Test #3:

score: 10
Accepted
time: 1ms
memory: 1352kb

input:

300 1
0.02275200 0.00255280 0.00714900 0.00673530 0.00625580 0.00952860 0.00503680 0.00361520 0.0085...

output:

0.0228

result:

ok single line: '0.0228'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1352kb

input:

300 34
0.01174930 0.00237960 0.00725200 0.00622610 0.00092020 0.00915390 0.00050940 0.00135760 0.006...

output:

0.0118

result:

ok single line: '0.0118'

Test #5:

score: 10
Accepted
time: 2ms
memory: 1356kb

input:

300 180
0.03276550 0.00945640 0.00095320 0.00353310 0.00647080 0.00637530 0.00059110 0.00265000 0.00...

output:

0.0331

result:

ok single line: '0.0331'

Test #6:

score: 10
Accepted
time: 0ms
memory: 1352kb

input:

300 78
0.07426740 0.00030970 0.00922200 0.00879440 0.00434000 0.00690410 0.00787240 0.00838550 0.005...

output:

0.0743

result:

ok single line: '0.0743'

Test #7:

score: 10
Accepted
time: 0ms
memory: 1352kb

input:

300 21
0.03122890 0.00933980 0.00300750 0.00424390 0.00213370 0.00940520 0.00636220 0.00227220 0.007...

output:

0.0315

result:

ok single line: '0.0315'

Test #8:

score: 10
Accepted
time: 0ms
memory: 1352kb

input:

6 4
0.64261410 0.35418080 0.00144510 0.00171790 0.00002830 0.00001380

output:

0.9831

result:

ok single line: '0.9831'

Test #9:

score: 10
Accepted
time: 0ms
memory: 1348kb

input:

6 1
0.23944990 0.51892380 0.07985400 0.07066520 0.03907530 0.05203180

output:

0.2394

result:

ok single line: '0.2394'

Test #10:

score: 10
Accepted
time: 0ms
memory: 1348kb

input:

6 3
1 0 0 0 0 0

output:

1.0000

result:

ok single line: '1.0000'