結果
| 問題 |
No.959 tree and fire
|
| コンテスト | |
| ユーザー |
Konton7
|
| 提出日時 | 2020-01-18 11:59:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 626 bytes |
| コンパイル時間 | 2,423 ms |
| コンパイル使用メモリ | 194,468 KB |
| 最終ジャッジ日時 | 2025-01-08 19:58:50 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 54 |
コンパイルメッセージ
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:114,
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:
/usr/include/c++/13/cmath:1073:17: warning: ‘p’ may be used uninitialized [-Wmaybe-uninitialized]
1073 | return pow(__type(__x), __type(__y));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:19:12: note: ‘p’ was declared here
19 | double p;
| ^
ソースコード
#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;
}
Konton7