結果

問題 No.959 tree and fire
ユーザー eSeF
提出日時 2020-11-06 10:51:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 998 bytes
コンパイル時間 1,073 ms
コンパイル使用メモリ 114,800 KB
最終ジャッジ日時 2025-01-15 20:01:34
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
int main(){
    cout << fixed << setprecision(10);
    ll N,M;double P;
    cin >> N >> M >> P;
    if(N==1){
        if(M==1){
            cout << P << endl;
        }
        else{
            cout << 2*P*P+(M-2)*P*P*P << endl;
        }
    }
    else{
        if(M==1){
            cout << 2*P*P+(N-2)*P*P*P << endl;
        }
        else{
            cout << 4*P*P*P+2*(N-2+M-2)*P*P*P*P+(N-2)*(M-2)*P*P*P*P*P << endl;
        }
    }
    return 0;
}
0