結果
問題 |
No.162 8020運動
|
ユーザー |
|
提出日時 | 2017-01-05 01:09:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 890 bytes |
コンパイル時間 | 450 ms |
コンパイル使用メモリ | 39,936 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-16 09:01:54 |
合計ジャッジ時間 | 105,170 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 TLE * 9 |
ソースコード
#include <cstdio> #include <array> #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) using namespace std; const int K = 14; int main() { int a; scanf("%d", &a); double p[3]; repeat (i,3) { scanf("%lf", &p[i]); p[i] /= 100; } array<double, (1<<K)> dp = {}; dp[(1<<K) - 1] = 1; for (; a < 80; ++ a) { repeat (s, 1<<K) { double q = 0; for (int t = s; t < (1<<K); ++ t |= s) { // s \subseteq t double r = dp[t]; for (int i = 1; i <= (1<<K); i <<= 1) if (t & i) { int j = bool(t & (i>>1)) + bool(t & (i<<1)); r *= (s & i ? 1 - p[j] : p[j]); } q += r; } dp[s] = q; } } double acc = 0; repeat (s, 1<<K) acc += __builtin_popcount(s) * dp[s]; printf("%.10lf\n", acc * 2); return 0; }