UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213373#2053. 地雷爆炸erican1001ms1724kbC++111.5kb2024-11-11 20:54:132024-11-11 23:04:25

answer

// Problem: A. 地雷爆炸
// Contest: undefined - NOIP2024训练赛 02
// URL: http://noi.ac/contest/1154/problem/2053
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
// Challenger: Erica N
// ----
// 
#include<bits/stdc++.h>

using namespace std;
#define rd read()
#define ull unsigned long long
#define int long long 
#define pb push_back
#define itn int
#define ps second 
#define pf first


#define rd read()
int read(){
  int xx = 0, ff = 1;char ch = getchar();
  while (ch < '0' || ch > '9'){
    if (ch == '-')ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')xx = xx * 10 + (ch - '0'), ch = getchar();
  return xx * ff;
}
#define zerol = 1
#ifdef zerol
#define cdbg(x...) do { cerr << #x << " -> "; err(x); } while (0)
void err() {cerr << endl;}
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) {
	for (auto v: a) cerr << v << ' ';err(x...);
}
template<typename T, typename... A>
void err(T a, A... x) {
	cerr << a << ' ';err(x...);
}
#else
#define dbg(...)
#endif
const int N=3e2+5;
const ull P=137;
const int INF=1e18+7;
/*

策略


*/	


double p[N],sp;
double f[N][N];
signed main(){
	int n=rd,m=rd;
	for(int i=0;i<n;i++){
		cin>>p[i];
	}
	
	
	f[m][0]=1;
	for(int i=m-1;~i;i--){
		f[i][0]=1;
		for(int j=0;j<=n;j++){
			f[i][1]+=f[i+1][j]*p[j];
		}
		
		for(int j=2;j<=n;j++){
			f[i][j]=f[i][j-1]*f[i][1];
		}
	}
	
	
	printf("%.4lf",f[0][1]);
	
	
}

详细

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

Test #1:

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

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: 0ms
memory: 1456kb

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: 0ms
memory: 1296kb

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: 1376kb

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: 1ms
memory: 1724kb

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: 1476kb

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: 1340kb

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: 1300kb

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: 1292kb

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: 1296kb

input:

6 3
1 0 0 0 0 0

output:

1.0000

result:

ok single line: '1.0000'