結果

問題 No.959 tree and fire
ユーザー kyoprounokyoprouno
提出日時 2020-03-03 22:32:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,026 bytes
コンパイル時間 1,971 ms
コンパイル使用メモリ 174,372 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 23:15:52
合計ジャッジ時間 3,362 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;

int main()
{
    double n,m,p;
    cin >> n >> m >> p;
    if(n==1 && m==1){
        cout << fixed << setprecision(30) << p << endl;
        return 0;
    }
    else if(n==1){
        cout << fixed << setprecision(30) << 2*p*p+(m-2)*p*p*p << endl;
        return 0;
    }
    else if(m==1){
        cout << fixed << setprecision(30) << 2*p*p+(n-2)*p*p*p << endl;
        return 0;
    }
    else{
        cout << fixed << setprecision(30) << 4*p*p*p+2*(n+m-4)*p*p*p*p+(n-2)*(m-2)*p*p*p*p*p << endl;
        return 0;
    }
    return 0;
} 
0