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. 2月11日 阿里巴巴Java开发手册 读后感

    该手册分为几个部分: 印象深刻的几点: (五)集合处理 2.[强制]ArrayList的subList结果不可强转成ArrayList,否则会抛出ClassCastException 异常:java. ...

  2. Vue 路由模块化配置

    博客地址:https://ainyi.com/77 企业运营后台页面很多,路由如若不区分模块化配置,所有路由挤在同一个文件将不好维护,所以路由的配置也要模块化 分享两个解决方案 -- Vue 路由配置 ...

  3. spring架构解析--入门一

    Spring 框架中的核心组件只有三个:Core.Context 和 Beans.它们构建起了整个 Spring 的骨骼架构.简单理解: spring core是工具,context是环境,而bean ...

  4. Linux的crond和crontab

    一.crond cron是一个linux下的定时执行工具(相当于windows下的scheduled task),可以在无需人工干预的情况下定时地运行任务task. 由于cron 是Linux的ser ...

  5. 如何将自己的代码发布到Maven中央仓库?

    去年在公司做工作流相关业务时,当时使用flowable做引擎,中途涉及到一些业务上的需求,自己整理了一些代码,考虑到开源精神,当时就想着将于公司业务无关的代码抽离出来,放到Maven中央仓库中,以供别 ...

  6. Spring源码剖析开篇:什么是Spring?

    在讲源码之前,先让我们回顾一下一下Spring的基本概念,当然,在看源码之前你需要使用过spring或者spirngmvc. Spring是什么 Spring是一个开源的轻量级Java SE(Java ...

  7. F#周报2019年第34期

    新闻 高效的F#,提示与技巧 Fable 社区资源 Visual Studio提示与技巧:为.NET增加生产力 无风险地尝试Compositional IT的培训包--如果没有增加任何价值,可以得到完 ...

  8. Docker安装Skywalking APM分布式追踪系统

    环境介绍 本文使用虚拟机unbutu18+docker.本unbutu18系统IP地址为:192.168.150.134 大家在使用时记得将此地址换成自己的实际地址. docker的安装可参考:htt ...

  9. python 34 多进程(二)

    目录 1. 互斥锁 2. 进程之间的通信 2.1 基于文件的通信 2.2 基于队列的通信 1. 互斥锁 ​ 当多个进程抢占同一数据时,将数据加锁,使进程按串行的方式去获取数据,先到先得,保证了公平.数 ...

  10. springboot--事务的使用

    @Transactional原理 事务是一些sql语句对数据库操作的集合,因此如果在一个Java方法里涉及了对数据库的操作,业务需要的话我们就可以考虑把这些操作作为一个事务.通过在方法上加个@Tran ...