結果
| 問題 |
No.813 ユキちゃんの冒険
|
| コンテスト | |
| ユーザー |
algon_320
|
| 提出日時 | 2019-04-12 22:49:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 797 bytes |
| コンパイル時間 | 1,508 ms |
| コンパイル使用メモリ | 161,672 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-01-02 03:35:01 |
| 合計ジャッジ時間 | 2,478 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
template <class T>
bool chmax(T &a, const T& b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T>
bool chmin(T &a, const T& b) {
if (a > b) {
a = b;
return true;
}
return false;
}
constexpr int INF = 1e9;
constexpr double EPS = 1e-5;
long double N, p, q;
long double ans;
void rec(int i, int dir, long double P) {
if (P < EPS || i == N) return;
if (i == 0) {
ans += P;
return;
}
rec(i + (dir ? 1 : -1), dir, P * q);
rec(i + ((dir ^ 1) ? 1 : -1), dir ^ 1, P * p);
}
signed main() {
cin >> N >> p >> q;
rec(1, 1, 1);
cout << ans << endl;
}
algon_320