結果

問題 No.162 8020運動
ユーザー chocoruskchocorusk
提出日時 2018-12-10 15:54:36
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,213 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 86,656 KB
実行使用メモリ 6,424 KB
最終ジャッジ日時 2023-10-14 22:13:43
合計ジャッジ時間 92,489 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,172 KB
testcase_01 AC 2,390 ms
6,232 KB
testcase_02 AC 3,717 ms
6,184 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 5 ms
6,184 KB
testcase_10 AC 3,710 ms
6,328 KB
testcase_11 AC 2,392 ms
6,184 KB
testcase_12 AC 1,065 ms
6,220 KB
testcase_13 TLE -
testcase_14 AC 270 ms
6,308 KB
testcase_15 AC 269 ms
6,328 KB
testcase_16 AC 1,331 ms
6,396 KB
testcase_17 AC 534 ms
6,232 KB
testcase_18 AC 4,775 ms
6,188 KB
testcase_19 AC 3,447 ms
6,400 KB
testcase_20 AC 4,126 ms
6,308 KB
testcase_21 AC 3,979 ms
6,332 KB
testcase_22 AC 3,714 ms
6,200 KB
testcase_23 AC 3,977 ms
6,296 KB
testcase_24 AC 3,710 ms
6,184 KB
testcase_25 AC 4,242 ms
6,180 KB
testcase_26 AC 5 ms
6,232 KB
testcase_27 AC 2,654 ms
6,188 KB
testcase_28 AC 4,775 ms
6,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int a; cin>>a;
    double p[3];
    cin>>p[0]>>p[1]>>p[2];
    p[0]/=100, p[1]/=100, p[2]/=100;
	double dp[21][1<<14]={};
	dp[0][(1<<14)-1]=1;
	for(int i=0; i<80-a; i++){
	    for(int j=1; j<(1<<14); j++){
	        if(i==0 && j<(1<<14)-1) continue;
	        for(int k=j; k>0; k=(k-1)&j){
	            double q=1;
	            int j0=j;
	            while(j0){
	                int l=((~j0)+1)&j0;
	                int c=0;
	                if(j&(l>>1)) c++;
	                if(j&(l<<1)) c++;
	                if(k&l) q*=(1-p[c]);
	                else q*=p[c];
	                j0^=l;
	            }
	            dp[i+1][k]+=(dp[i][j]*q);
	        }
	    }
	}
	double ans=0;
	for(int i=1; i<(1<<14); i++){
	    int c=0;
	    for(int j=0; j<14; j++){
	        if(i&(1<<j)) c++;
	    }
	    ans+=(dp[80-a][i]*(double)c);
	}
	printf("%.7lf\n", 2*ans);
    return 0;
}
0