結果

問題 No.77 レンガのピラミッド
ユーザー kutsutamakutsutama
提出日時 2018-12-19 00:55:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 428 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 11,888 KB
実行使用メモリ 10,248 KB
最終ジャッジ日時 2023-10-25 23:46:52
合計ジャッジ時間 2,243 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,080 KB
testcase_01 AC 27 ms
10,080 KB
testcase_02 AC 27 ms
10,080 KB
testcase_03 AC 27 ms
10,080 KB
testcase_04 AC 28 ms
10,080 KB
testcase_05 AC 27 ms
10,080 KB
testcase_06 RE -
testcase_07 AC 27 ms
10,080 KB
testcase_08 RE -
testcase_09 AC 27 ms
10,080 KB
testcase_10 AC 27 ms
10,080 KB
testcase_11 AC 27 ms
10,080 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 27 ms
10,080 KB
testcase_16 AC 27 ms
10,080 KB
testcase_17 AC 27 ms
10,080 KB
testcase_18 RE -
testcase_19 AC 28 ms
10,080 KB
testcase_20 AC 26 ms
10,080 KB
testcase_21 AC 26 ms
10,080 KB
testcase_22 AC 26 ms
10,080 KB
testcase_23 AC 27 ms
10,080 KB
testcase_24 AC 28 ms
10,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
sp = input().split()

a = [0] * 100
for i in range(n):
    a[i] = int(sp[i])

brick = sum(a)
height = math.floor(math.sqrt(brick))
width = height * 2 - 1
piramid = [0] * 100
for i in range(width // 2):
    piramid[i] = i + 1
    piramid[width - 1 - i] = piramid[i]
piramid[width // 2] = height

res = 0
for i in range(len(a)):
    if a[i] > piramid[i]:
        res += a[i] - piramid[i]

print(res)
0