結果
問題 | No.425 ジャンケンの必勝法 |
ユーザー |
|
提出日時 | 2020-03-01 03:35:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 338 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 72,032 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 20:26:16 |
合計ジャッジ時間 | 1,460 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 18 |
コンパイルメッセージ
main.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 14 | main() | ^~~~
ソースコード
#include<iostream>#include<iomanip>#include<algorithm>using namespace std;double p0,q;double ans=1./3;void dfs(double w,double p){if(w<1e-10)return;ans+=w*(p/2+(1-p)/3);dfs(w*p/2,max(p-q,0.));dfs(w*(1-p)/3,min(p+q,1.));}main(){cin>>p0>>q;p0/=100;q/=100;dfs(1./3,p0);cout<<fixed<<setprecision(16)<<ans<<endl;}