結果

問題 No.959 tree and fire
ユーザー lllllll88938494
提出日時 2023-03-30 00:47:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,608 KB
最終ジャッジ日時 2024-09-21 14:58:33
合計ジャッジ時間 3,736 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w=map(int,input().split())
p=float(input())
ans = 0

t1 = max(h-2,0) * max(w-2,0) * (p**5)

t2 = 0
if w >= 2:
    if h == 1:
        t2 += (w - 2) * (p ** 3)
    else:
        t2 += (w - 2) * 2 * (p**4)
        
if h >= 2:
    if w == 1:
        t2 += (h - 2) * (p ** 3)
    else:
        t2 += (h - 2) * 2 * (p**4)
        



if h >= 2 and w >= 2:
    t3 = 4 * (p**3)
elif h < 2 and w < 2:
    t3 = p
else:
    t3 = 2 * (p**2) 
 
print(t1 + t2 + t3)
0