-->
当前位置:首页 > 题库

PROGRAMMING:Finding the sum of sequence cubes

Luz5年前 (2021-05-10)题库406
Write program, input positive integer $$n $$, calculate cubic sum $$s = 1 ^ 3 + 2 ^ 3 + 3 ^ 3 + \ cdots + n ^ 3 $$.
####Input format
> $$n$$
####Output format
> $$s$$
Note: both $$n $$and $$s $$are in the range of long long int.
####Input sample
```in
fifteen thousand nine hundred and seventy-three
```
####Output sample
```out
sixteen thousand two hundred and seventy-five trillion and seven hundred and twenty-five billion three hundred and thirty-four million four hundred and seventy-five thousand two hundred and one
```
Tips:





















$$1^3 = 1$$$$1^2 = 1$$
$$1^3 + 2^3 = 9$$$$(1 + 2) ^ 2 = 9$$
$$1^3 + 2^3 + 3^3 = 36$$$$(1 + 2 + 3) ^ 2 = 36$$
$$1^3 + 2^3 + 3^3 + 4^3 = 100$$$$(1 + 2 + 3 + 4) ^ 2 = 100$$
$$\cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots$$$$\cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots$$








answer:If there is no answer, please comment
This problem can be solved directly by formula without using circular sentence.