結果
| 問題 |
No.959 tree and fire
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-22 12:11:05 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 495 bytes |
| コンパイル時間 | 306 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-14 02:38:18 |
| 合計ジャッジ時間 | 2,511 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 WA * 7 |
ソースコード
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
def f(N, M, p):
if N > M:
N, M = M, N
s = [0] * 5
if N == 1:
if M > 1:
s[1] = 2
s[2] = M-2
else:
s[2] = 4
s[3] = 2 * (N-2 + M-2)
s[4] = (N-2) * (M-2)
res = N*M * p
for i in [1, 2, 3, 4]:
res -= s[i] * (1-p**i) * p
if res < 0:
res = 0
return res
N, M = map(int, raw_input().split())
p = float(raw_input())
res = f(N, M, p)
print res