結果
| 問題 |
No.162 8020運動
|
| ユーザー |
chocorusk
|
| 提出日時 | 2018-12-10 15:54:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,213 bytes |
| コンパイル時間 | 704 ms |
| コンパイル使用メモリ | 85,312 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-09-16 15:53:16 |
| 合計ジャッジ時間 | 25,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 TLE * 9 |
ソースコード
#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;
}
chocorusk