結果
問題 | No.959 tree and fire |
ユーザー |
![]() |
提出日時 | 2019-12-22 00:21:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 1,557 ms |
コンパイル使用メモリ | 169,332 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 04:44:39 |
合計ジャッジ時間 | 3,075 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); long long n, m; cin >> n >> m; double p; cin >> p; if (n > m) { swap(n, m); } vector<long long> c(5); if (n == 1) { if (m == 1) { c[0] = 1; } else { c[1] = 2; c[2] = m - 2; } } else { c[2] = 4; c[3] = 2 * (n + m - 4); c[4] = n * m - c[2] - c[3]; } double res = 0; for (int x = 0; x <= 4; ++x) { res += c[x] * pow(p, x + 1); } cout << fixed << setprecision(15) << res << '\n'; }