結果

問題 No.959 tree and fire
ユーザー masumasumath1
提出日時 2020-01-03 12:21:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-22 19:04:21
合計ジャッジ時間 3,343 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
p = float(input())
ans = 0
#1マスのとき
if N == 1 and M == 1:
    print(p)
    exit()
#細長いとき
if (N == 1 and M != 1) or (N != 1 and M == 1):
    E = max(N,M)
    print(2* p**2 + (E-2)* p**3)
    exit()
#それ以外
print(4* p**3 + 2*(M+N-4)* p**4 + (M-2)*(N-2)* p**5 )
0