結果
問題 | No.813 ユキちゃんの冒険 |
ユーザー | algon_320 |
提出日時 | 2019-04-12 22:49:20 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 797 bytes |
コンパイル時間 | 1,731 ms |
コンパイル使用メモリ | 165,020 KB |
実行使用メモリ | 4,388 KB |
最終ジャッジ日時 | 2023-08-30 13:32:08 |
合計ジャッジ時間 | 2,644 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | WA | - |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 1 ms
4,376 KB |
testcase_17 | WA | - |
testcase_18 | AC | 1 ms
4,380 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 2 ms
4,388 KB |
testcase_24 | AC | 2 ms
4,376 KB |
testcase_25 | WA | - |
ソースコード
#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; }