結果

問題 No.162 8020運動
ユーザー kimiyukikimiyuki
提出日時 2017-01-05 01:09:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 890 bytes
コンパイル時間 1,635 ms
コンパイル使用メモリ 38,856 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-22 12:11:10
合計ジャッジ時間 21,413 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 300 ms
4,380 KB
testcase_01 AC 2,983 ms
4,380 KB
testcase_02 AC 4,483 ms
4,380 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0