mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
6b96701ad0
commit
cd006384fc
45
S2OJ/578/578.cpp
Normal file
45
S2OJ/578/578.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 15 + 2,
|
||||
K = 105;
|
||||
|
||||
int k, n, p[N], s[N];
|
||||
double f[K][1 << N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> k >> n;
|
||||
|
||||
for (int i = 1, x; i <= n; i++) {
|
||||
cin >> p[i];
|
||||
|
||||
while (cin >> x, x) {
|
||||
s[i] |= 1 << x - 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = k; i; i--) {
|
||||
for (int t = 0; t < 1 << n; t++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
if ((t & s[j]) == s[j]) {
|
||||
f[i][t] += std::max(f[i + 1][t], f[i + 1][t | (1 << j - 1)] + p[j]);
|
||||
} else {
|
||||
f[i][t] += f[i + 1][t];
|
||||
}
|
||||
}
|
||||
|
||||
f[i][t] /= n;
|
||||
}
|
||||
}
|
||||
|
||||
cout << std::fixed << std::setprecision(6) << f[1][0] << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/578/data/ex_jlg1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/ex_jlg1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/ex_jlg1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/ex_jlg1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/ex_jlg2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/ex_jlg2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/ex_jlg2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/ex_jlg2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/jlg9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/jlg9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/578/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/578/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user