본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 15001번 Frog Leaps

by 현장 2023. 4. 2.

-Code

from sys import stdin
input = stdin.readline
n = int(input())
d = [int(input()) for _ in range(n)]
res = 0

for i in range(1, n):
    res += (d[i] - d[i - 1]) ** 2
print(res)