結果
| 問題 | No.162 8020運動 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-19 23:11:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,350 bytes |
| 記録 | |
| コンパイル時間 | 2,005 ms |
| コンパイル使用メモリ | 198,556 KB |
| 実行使用メモリ | 11,428 KB |
| 最終ジャッジ日時 | 2025-12-19 23:11:50 |
| 合計ジャッジ時間 | 8,970 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | -- * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int A; cin >> A;
double p0,p1,p2; cin >> p0 >> p1 >> p2;
p0 /= 100,p1 /= 100,p2 /= 100;
int n = 14,n2 = 1<<n;
vector<double> dp(n2);
dp.at(n2-1) = 2;
while(A < 80){
vector<double> next(n2);
for(int i=0; i<n2; i++){
if(dp.at(i) == 0) continue;
double d = dp.at(i);
for(int k=i; ; k=(k-1)&i){
double mul = 1;
for(int p=0; p<n; p++) if(i&(1<<p)){
int ok = (i>>(p+1))&1;
if(p) ok += (i>>(p-1))&1;
if(k&(1<<p)){
if(ok == 0) mul *= (1-p0);
else if(ok == 1) mul *= (1-p1);
else mul *= (1-p2);
}
else{
if(ok == 0) mul *= p0;
else if(ok == 1) mul *= p1;
else mul *= p2;
}
}
next.at(k) += d*mul;
if(k == 0) break;
}
}
swap(dp,next),A++;
}
double answer = 0;
for(int i=0; i<n2; i++) answer += __popcount(i)*dp.at(i);
cout << fixed << setprecision(20) << answer << endl;
}