結果

問題 No.80 四角形を描こう
ユーザー JunOnumaJunOnuma
提出日時 2017-06-15 18:18:54
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 328 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 7,052 KB
実行使用メモリ 6,440 KB
最終ジャッジ日時 2023-10-25 07:00:32
合計ジャッジ時間 1,091 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n = int(raw_input())
l = map(int, raw_input().split())
d = int(math.sqrt(sum(l)))
p = 0
m = 0
for i in range(n):
    if i < d:
        t = i + 1
    elif i < 2 * d - 1:
        t = 2 * d - (i + 1)
    else:
        t = 0
    if l[i] > t:
        p += l[i] - t
    elif t > l[i]:
        m += t - l[i]
print max(p,m)
0