Lyndon's Golf Contest 1 P2 - A Cube Problem

View as PDF

Submit solution

Points: 1 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type
Allowed languages

Your friend needs you to help him golf his coding assignment! The problem is as follows:

Given an integer n (1 \le n \le 10^6), calculate the sum of the first n cubes: 1^3 + 2^3 + \dots + n^3.

Note: You may only submit to this problem in Python 3.

Input Specification

The first line of input contains a single integer n.

Output Specification

Output the sum of the first n cubes.


Your score will be computed based on the length of your source code, the shorter the better. For an L-byte program,

  • if L \le 34, you will receive the full 100 points.
  • if 35 \le L \le 37, you will receive 80-10 \times (L-35) points.
  • if 38 \le L, you will receive \lfloor 2^{0.26(60-L)} \rfloor points.

Sample Input


Sample Output



There are no comments at the moment.