結果

問題 No.959 tree and fire
ユーザー masumasumath1
提出日時 2020-01-03 11:55:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 618 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,448 KB
最終ジャッジ日時 2024-11-22 19:03:10
合計ジャッジ時間 131,686 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 TLE * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
p = float(input())
ans = 0
for i in range(N):
    for j in range(M):
        #角のとき
        if (i,j) in [(0,0),(0,M-1),(N-1,0),(N-1,M-1)]:
            if N == 1 and M == 1:
                print(p)
                exit()
            if N == 1 or M == 1:
                ans += p**2
            else:
                ans += p**3
        #端のとき
        elif (i in [0,N-1]) or (j in [0,M-1]):
            if N == 1 or M == 1:
                ans += p**3
            else:
                ans += p**4
        #真ん中のとき
        else:
            ans += p**5
print(ans)
0