結果

問題 No.959 tree and fire
ユーザー yomo3
提出日時 2020-02-21 02:30:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-10-08 19:37:57
合計ジャッジ時間 3,267 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
P = float(input())

x_corner = 3
if M == 1: x_corner -= 1
if N == 1: x_corner -= 1
x_ud = 4
if N < 2: x_ud -= 1
x_lr = 4
if M < 2: x_lr -= 1
x_inner = 5

corner = 4
if N == M == 1: corner = 1
elif N == 1 or M == 1: corner = 2
ud = max(0, 2 * (M - 2))
lr = max(0, 2 * (N - 2))
inner = max(0, M - 2) * max(0, N - 2)

ans = corner * P**x_corner + ud * P**x_ud + lr * P**x_lr + inner * P**x_inner
print(ans)
0