結果

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

ソースコード

diff #

N, M = map(int, input().split())
P = float(input())
if N == 1 and M == 1:
    print(P)
elif N == 1:
    print((P ** 2) * 2 + (P ** 3)*(M - 2))
elif M == 1:
    print((P ** 2) * 2 + (P ** 3) * (N - 2))
else:
    print((P ** 3) * 4 + (P ** 4) * (N - 2) * 2 + (P ** 4) * (M - 2) * 2 + (P ** 5) * (N - 2) * (M - 2))
0