File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ int const N = 101 ;
6
+ int n;
7
+ double a[N];
8
+
9
+ int main () {
10
+ double mx = 0 ;
11
+ cin >> n;
12
+ for (int i = 0 ; i < n; ++i)
13
+ cin >> a[i];
14
+
15
+ sort (a, a + n);
16
+ reverse (a, a + n);
17
+
18
+ double res = 0 ;
19
+ for (int k = 0 ; k < n; ++k) {
20
+ double sol = 0 ;
21
+ for (int i = 0 ; i <= k; ++i) {
22
+ double cur = a[i];
23
+ for (int j = 0 ; j <= k; ++j)
24
+ if (i != j)
25
+ cur *= (1.0 - a[j]);
26
+ sol += cur;
27
+ }
28
+ res = max (res, sol);
29
+ }
30
+
31
+ cout << fixed << setprecision (10 ) << res << endl;
32
+
33
+ return 0 ;
34
+ }
Original file line number Diff line number Diff line change 170
170
- [ 441A. Valera and Antique Items] ( http://codeforces.com/problemset/problem/441/A )
171
171
- [ 441C. Valera and Tubes] ( http://codeforces.com/contest/441/problem/C )
172
172
- [ 443A. Anton and Letters] ( http://codeforces.com/problemset/problem/443/A )
173
+ - [ 443D. Andrey and Problem] ( http://codeforces.com/contest/443/problem/D )
173
174
- [ 448A. Rewards] ( http://codeforces.com/problemset/problem/448/A )
174
175
- [ 448D. Multiplication Table] ( http://codeforces.com/contest/448/problem/D )
175
176
- [ 449B. Jzzhu and Cities] ( http://codeforces.com/contest/449/problem/B )
You can’t perform that action at this time.
0 commit comments