← Back to List

26550번: Ornaments ↗

Solutions

Python 3
123 B | 123 chars
for i in range(int(input())):
    n = int(input())
    print(((n * (n + 1) * (2 * n + 1) // 6) + (n * (n + 1) // 2)) // 2)