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的更多相关文章
- Kylin知识点介绍
Kylin is an open source Distributed Analytics Engine from eBay Inc.that provides SQL interface and m ...
- (寒假集训)Roadblock(最短路)
Roadblock 时间限制: 1 Sec 内存限制: 64 MB提交: 9 解决: 5[提交][状态][讨论版] 题目描述 Every morning, FJ wakes up and walk ...
- 如何通过java代码对kylin进行cube build
通常是用于增量 代码如下: package com.dlht.kylinDemo; import java.io.BufferedReader; import java.io.FileNotFound ...
- cf492A Vanya and Cubes
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- codeforces 887B Cubes for Masha 两种暴力
B. Cubes for Masha time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- 寒假集训——搜索 D - Cubes for Masha
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h&g ...
- 通过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 ...
- 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 ...
- 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 ...
随机推荐
- react-native 入门基础介绍
目录 安装 项目 主要目录结构 入口 Home模块 Coobook模块 List模块 novel模块 相关参考 一个简单的demo,用于介绍react-native相关基础信息,主要是针对有兴趣的同学 ...
- python中下标和切片的使用
下标 所谓下标就是编号,就好比超市中存储柜的编号,通过这个编号就能找到相应的存储空间. Python中字符串,列表,元祖均支持下标索引. 例如: # 如果想取出部分字符,可使用下标 name=&quo ...
- pdf.js跨域加载文件
pdf.js一个基于Html的工具类,熟悉pdf.js的朋友们很清楚,pdf.js帮助我们做了很多事.尤其金融类网站会产生很多的报表.需要在线预览.pdf.js绝对是我们的首选 本地预览 在pdf.j ...
- Python.append()与Python.extend()的区别
lst=[1,2] >>>[1,2] lst.append([3,4]) >>>[1, 2, [3, 4]] lst.extend([3,4]) >>& ...
- 如何让textarea placeholder 文字垂直居中
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- C/C++ 数据类型
C/C++ 数据类型 C语言包含5个基本数据类型: void, integer, float, double, 和 char. 类型 描述 字节数 取值范围 void 空类型 1 int 整型 4 - ...
- unsqueeze 和 squeeze
squeeze压缩的意思 就是在第几维为1 去掉 unsqueeze 解缩 在第几维增加 变成*1 squeeze用法 c = b.view(1, 1, 1, 2, 3) c.squeeze(0) # ...
- linux系统磁盘满了,怎么解决?
1.使用命令:df -lk 或 df -hl 发现果然有个磁盘已满 2.使用命令:du --max-depth=1 -h 查找大文件,发现/home文件夹下有17G的东西,因为我的apache是装在 ...
- bs4-BeautifulSoup
1.BeautifulSoup下载 pip install BeautifulSoup4 或者 pip install bs4 pip install lxml #解析器 2.BeautifulSou ...
- python学习笔记(2)--列表、元组、字符串、字典、集合、文件、字符编码
本节内容 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 1.列表和元组的操作 列表是我们以后最长用的数据类型之一,通过列表可以最方便的对数据实现最方便的存储.修改等操作 定 ...