結果

問題 No.959 tree and fire
コンテスト
ユーザー Konton7
提出日時 2020-01-18 11:59:05
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 626 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,312 ms
コンパイル使用メモリ 209,772 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-08 15:09:33
合計ジャッジ時間 2,845 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 54
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:115,
                 from main.cpp:1:
In function 'constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up) [with _Tp = double; _Up = int]',
    inlined from 'int main()' at main.cpp:25:20:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/cmath:1084:17: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized]
 1084 |       return pow(__type(__x), __type(__y));
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function 'int main()':
main.cpp:19:12: note: 'p' was declared here
   19 |     double p;
      |            ^

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define DEBUG

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int h, w;
    ll s;
    double p;
    cin >> h >> w;
    
    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, 3) * (2*(h + w - 4)) + pow(p, 5) * ( (h-2) * (w-2) );
    printf("%.8f\n" , p);
    

    return 0;
}
0