목차

귀찮음

ps
링크acmicpc.net/…
출처BOJ
문제 번호16208
문제명귀찮음
레벨실버 5
분류

애드혹

시간복잡도O(n)
인풋사이즈n<=500,000
사용한 언어Python 3.13
제출기록63380KB / 152ms
최고기록136ms
해결날짜2026/03/04

풀이

코드

"""Solution code for "BOJ 16208. 귀찮음".

- Problem link: https://www.acmicpc.net/problem/16208
- Solution link: http://www.teferi.net/ps/problems/boj/16208

Tags: [ad hoc]
"""


def main():
    _n = int(input())
    a = [int(x) for x in input().split()]

    answer = 0
    l = 0
    for a_i in a:
        answer += l * a_i
        l += a_i
    print(answer)


if __name__ == '__main__':
    main()