結果

問題 No.1233 割り切れない気持ち
コンテスト
ユーザー NatsubiSogan
提出日時 2020-09-26 18:42:01
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 952 ms / 3,153 ms
コード長 345 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 409 ms
コンパイル使用メモリ 20,572 KB
実行使用メモリ 34,240 KB
最終ジャッジ日時 2026-03-19 01:22:54
合計ジャッジ時間 14,085 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
ans = 0
m = max(a)
lis = [0] * (m + 1)
for i in a:
    lis[i] += 1
cum = list(accumulate(lis))
for i in range(1, m + 1):
    if lis[i] == 0:
        continue
    for j in range(i, m + 1, i):
        ans += lis[i] * i * (n - cum[j - 1])
print(sum(a) * n - ans)
0