結果
問題 |
No.813 ユキちゃんの冒険
|
ユーザー |
![]() |
提出日時 | 2019-04-12 21:42:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 814 bytes |
コンパイル時間 | 2,204 ms |
コンパイル使用メモリ | 203,188 KB |
最終ジャッジ日時 | 2025-01-07 01:44:11 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 TLE * 9 MLE * 4 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} struct Precision{ Precision(){ cout<<fixed<<setprecision(12); } }precision_beet; //INSERT ABOVE HERE signed main(){ Int n; cin>>n; using D = long double; D p,q; cin>>p>>q; const D EPS = 1e-10; using T = tuple<Int, Int, D>; queue<T> que; que.emplace(1,1,1.0); D ans=0; while(!que.empty()){ Int v,d;D x; tie(v,d,x)=que.front();que.pop(); if(x<EPS) continue; if(v+d==0) ans+=x*q; if(0<v+d&&v+d<=n) que.emplace(v+d,d,x*q); if(v-d==0) ans+=x*p; if(0<v-d&&v-d<=n) que.emplace(v-d,-d,x*p); } cout<<ans<<endl; return 0; }