結果
| 問題 | No.959 tree and fire |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-01 20:56:17 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 2,000 ms |
| コード長 | 562 bytes |
| 記録 | |
| コンパイル時間 | 471 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 15,448 KB |
| 最終ジャッジ日時 | 2026-04-06 20:28:44 |
| 合計ジャッジ時間 | 9,169 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = map(int,readline().split())
P = float(read())
def F(N,M,P):
if N > M:
N,M = M,N
A = []
if N == M == 1:
A = [(1,P)]
elif N == 1:
A.append((2, P**2))
A.append((M-2, P**3))
else:
A.append((4,P**3))
A.append((N+N+M+M-8,P**4))
A.append(((N-2)*(M-2),P**5))
return sum(n * p for n,p in A)
# F(1,2,0.5), F(2,2,0.25), F(1333,79,0.63)
answer = F(N,M,P)
print(answer)
maspy