結果
問題 |
No.959 tree and fire
|
ユーザー |
|
提出日時 | 2023-01-28 20:06:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 56,064 KB |
最終ジャッジ日時 | 2024-06-28 22:16:54 |
合計ジャッジ時間 | 4,947 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.buffer.readline N,M = map(int,input().split()) P = float(input()) ans = 0 N,M = min(N,M),max(N,M) if N==1: if M==1: print(P) else: ans = 2*P + (M-2)*P**2 ans *= P print(ans) exit() ans += 4*P**2 ans += 2*(N+M-4)*P**3 ans += (N-2)*(M-2)*P**4 ans *= P print(ans)