結果

問題 No.959 tree and fire
ユーザー tktk_snsntktk_snsn
提出日時 2021-03-02 00:40:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-03 01:21:27
合計ジャッジ時間 3,186 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M = map(int, input().split())
    P = float(input())
    if N == M == 1:
        return P
    if N == 1:
        ans = 2 * pow(P, 2) + (M - 2) * pow(P, 3)
        return ans
    if M == 1:
        ans = 2 * pow(P, 2) + (N - 2) * pow(P, 3)
    ans = 4 * pow(P, 3)
    ans += 2 * (N - 2 + M - 2) * pow(P, 4)
    ans += (N - 2) * (M - 2) * pow(P, 5)
    return ans 

print("{:.26f}".format(main()))
0