結果

問題 No.162 8020運動
ユーザー chocoruskchocorusk
提出日時 2018-12-10 15:12:49
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,173 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-10-14 22:11:06
合計ジャッジ時間 13,265 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 474 ms
6,396 KB
testcase_01 AC 4,714 ms
6,324 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
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 <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=0; j<(1<<14); j++){
	        for(int k=j; k>0; k=(k-1)&j){
	            double q=1;
	            for(int l=0; l<14; l++){
	                if((j&(1<<l))==0) continue;
	                int c=0;
	                if(l>0 && j&(1<<(l-1))) c++;
	                if(l<13 && j&(1<<(l+1))) c++;
	                if(k&(1<<l)) q*=(1-p[c]);
	                else q*=p[c];
	            }
	            dp[i+1][k]+=(dp[i][j]*q);
	        }
	    }
	}
	double ans=0;
	for(int i=0; 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