結果

問題 No.959 tree and fire
ユーザー Forested
提出日時 2020-05-26 12:34:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 92,296 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-13 02:37:59
合計ジャッジ時間 2,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
    cout << fixed << setprecision(15);
    
    long long N, M;
    long double P;
    cin >> N >> M >> P;
    if (N > M) swap(N, M);
    if (N == 1) {
        if (M == 1) cout << P << endl;
        else cout << P * P * 2 + P * P * P * (M - 2) << endl;
    } else {
        cout << P * P * P * 4 + P * P * P * P * (2 * N + 2 * M - 8) + P * P * P * P * P * (N - 2) * (M - 2) << endl;
    }
    return 0;
}
0