結果

問題 No.77 レンガのピラミッド
ユーザー nbisco
提出日時 2016-08-17 22:39:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 222 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-07 19:03:53
合計ジャッジ時間 1,884 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
A = [int(i) for i in input().strip().split(" ")]
S = sum(A)

pymd = math.floor(math.sqrt(S))
ans = 0
for i in range(N):
    ans += max(0, A[i] - max(0, pymd - abs((pymd - 1) - i)))
print(ans)
0