結果
問題 |
No.959 tree and fire
|
ユーザー |
![]() |
提出日時 | 2020-01-18 12:04:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 477 bytes |
コンパイル時間 | 2,043 ms |
コンパイル使用メモリ | 192,476 KB |
最終ジャッジ日時 | 2025-01-08 20:00:13 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll h, w; double p; cin >> h >> w; cin >> p; if (h == 1 && w == 1) p = p; else if (h == 1) p = 2 * pow(p, 2) + pow(p, 3) * (w - 2); else if (w == 1) p = 2 * pow(p, 2) + pow(p, 3) * (h - 2); else p = 4 * pow(p, 3) + pow(p, 4) * (2*(h + w - 4)) + pow(p, 5) * ( (h-2) * (w-2) ); printf("%.8f\n" , p); return 0; }