Build a pile of Cubes

Posted cepaallium

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Build a pile of Cubes相关的知识,希望对你有一定的参考价值。

version_1:


def find_nb(m):
# your code
ii = 1
total = 0
while total < m:
total = sum(each**3 for each in range(ii))
ii += 1
if total == m:
result = ii-2
else:
result = -1
return result

 

version_2:

 

def find_nb(m):
# your code
i = 1
while m>0:
m = m - i**3
i += 1
return -1 if m<0 else i-1

以上是关于Build a pile of Cubes的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #575 (Div. 3) (A. Three Piles of Candies)(数学)

pile的用法是啥?

microsoft build of openjdk啥东西?

A cycle was detected in the build path of project

A cycle was detected in the build path of project

A cycle was detected in the build path of project项目相互依赖