結果

問題 No.959 tree and fire
ユーザー ああいいああいい
提出日時 2022-05-29 17:18:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,608 KB
最終ジャッジ日時 2024-09-21 00:23:45
合計ジャッジ時間 4,536 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys
if N > 1 and M > 1:
    ans += P ** 5 * (N - 2) * (M - 2)
    ans += P ** 4 * (N + M - 4) * 2
    ans += P ** 3 * 4
    print(ans)
    exit()
if N == 1 and M == 1:
    print(P)
    exit()
else:
    if M == 1:
        N,M = M,N
    ans += P ** 3 * (M - 2)
    ans += P ** 2 * 2
    print(ans)
0