結果
| 問題 | No.155 生放送とBGM |
| コンテスト | |
| ユーザー |
yosupot
|
| 提出日時 | 2015-02-18 00:01:37 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,378 ms / 6,000 ms |
| コード長 | 1,207 bytes |
| 記録 | |
| コンパイル時間 | 500 ms |
| コンパイル使用メモリ | 93,208 KB |
| 実行使用メモリ | 12,620 KB |
| 最終ジャッジ日時 | 2026-03-09 04:03:38 |
| 合計ジャッジ時間 | 10,527 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
//#define NDEBUG
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
double fact(int n) {
if (n <= 1) return 1;
return fact(n-1)*n;
}
int d[55];
double dp[55][20000];
double solve() {
int n, l;
cin >> n >> l;
for (int i = 0; i < n; i++) {
int x, y;
scanf("%d:%d", &x, &y);
d[i] = x*60+y;
}
double res = 0;
for (int i = 0; i < n; i++) {
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int j = 0; j < n; j++) {
if (i == j) continue;
for (int u = 54; u >= 1; u--) {
for (int k = 19000; k >= d[j]; k--) {
dp[u][k] += dp[u-1][k-d[j]];
}
}
}
for (int u = 0; u < 55; u++) {
double p = 0;
for (int k = 0; k < 60*l; k++) {
p += dp[u][k];
}
p *= fact(u)*fact(n-(u+1));
res += p;
}
}
return res/fact(n);
}
int main() {
printf("%.20f\n", solve());
return 0;
}
yosupot