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的更多相关文章

  1. Kylin知识点介绍

    Kylin is an open source Distributed Analytics Engine from eBay Inc.that provides SQL interface and m ...

  2. (寒假集训)Roadblock(最短路)

    Roadblock 时间限制: 1 Sec  内存限制: 64 MB提交: 9  解决: 5[提交][状态][讨论版] 题目描述 Every morning, FJ wakes up and walk ...

  3. 如何通过java代码对kylin进行cube build

    通常是用于增量 代码如下: package com.dlht.kylinDemo; import java.io.BufferedReader; import java.io.FileNotFound ...

  4. cf492A Vanya and Cubes

    A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. codeforces 887B Cubes for Masha 两种暴力

    B. Cubes for Masha time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. 寒假集训——搜索 D - Cubes for Masha

    #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h&g ...

  7. 通过java代码对kylin进行cube build

    转:http://www.cnblogs.com/hark0623/p/5580632.html 通常是用于增量 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 ...

  8. Codeforces Round #356 (Div. 2) D. Bear and Tower of Cubes dfs

    D. Bear and Tower of Cubes 题目连接: http://www.codeforces.com/contest/680/problem/D Description Limak i ...

  9. Codeforces Round #280 (Div. 2) A. Vanya and Cubes 水题

    A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

随机推荐

  1. javaweb基础整理随笔-----上传与下载步骤详解

    这次整理的是上传与下载的原生代码解析: 上传:1.对页面的要求:enctype="multipart/form-data" method="post"      ...

  2. 关于JSON解析的问题(js序列化及反序列化)

    我们都知道,现在的开发模式都是前后端分离的,后台返回数据给前端,前端负责数据交互并渲染到页面,所以我们需要从后端接口上获取数据显示到页面上.在接受服务器端数据数据时,一般是字符串.这时,就需要用到JS ...

  3. JS扫雷小游戏

    HTML代码 <title> 扫雷 </title> <!-- ondragstart:防拖拽生成新页面 oncontextmenu:屏蔽右键菜单--> <b ...

  4. 如何永久破解IDEA 2019.2

    声明: 支持知识产权,支持正版产权,以下仅限个人学习使用IDEA工具时随笔记录,禁止商业使用. 以下个人提供的激活补丁和激活码来源,均由网上下载,各位也可以自行查找. IDEA官网下载地址:https ...

  5. (三十)c#Winform自定义控件-文本框(三)

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...

  6. 自己实现spring核心功能 一

    聊聊spring spring对于java开发者来说,是最熟悉不过的框架了,我们日常开发中每天都在使用它.它有着各种各样的好处,简单易用,得心应手... ... 我们一说到spring就会讲到ioc ...

  7. ubuntu 开机进入grub rescue> 解决办法(nvme固态硬盘)

    起因: 我是在windows下格式化了ubuntu的盘,然后重新安装ubuntu就出现了这种问题.卸载ubuntu的正确姿势,要去查一下,千万不要直接格式化. 解决方法: 1.  先使用ls命令,找到 ...

  8. StudyAndroid.1

    目标: 手动创建第一个Activity 开发环境: Android Studio 3.3.1 Build #AI-182.5107.16.33.5264788, built on January 29 ...

  9. 如何美观地打印 Python 对象?这个标准库可以简单实现

    前不久,我写了一篇文章回顾 Python 中 print 的发展历史 ,提到了两条发展线索: 明线:早期的 print 语句带有 C 和 Shell 的影子,是个应用程序级的 statement,在最 ...

  10. c++中strcmp,strcopy函数的使用

    1.strcmp(str1,str2) C/C++函数,比较两个字符串, 设这两个字符串为str1,str2,若str1==str2,则返回零:若str1<str2,则返回负数:若str1> ...