A. Vanya and Cubes
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 + 3 = 6 cubes, and so on. Thus, the i-th level of the pyramid must have 1 + 2 + ... + (i - 1) + i cubes.

Vanya wants to know what is the maximum height of the pyramid that he can make using the given cubes.

Input

The first line contains integer n (1 ≤ n ≤ 104) — the number of cubes given to Vanya.

Output

Print the maximum possible height of the pyramid in the single line.

Sample test(s)
input
1
output
1
input
25
output
4
Note

Illustration to the second sample:

水题、

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1e9;
const double eps = 1e-;
int cas = ; int main()
{
#ifdef LOCAL
// freopen("case.txt","r",stdin);
#endif
int n,ans,sum,sum2;
while(cin>>n)
{
ans = sum = sum2 = ;
while(true)
{
if(sum2 > n) break;
ans ++ ;
sum += ans;
sum2 += sum;
}
cout << ans- << endl;
}
return ;
}

CodeForces 492A Vanya and Cubes的更多相关文章

  1. 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 ...

  2. cf492A Vanya and Cubes

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

  3. codeforces 492E. Vanya and Field(exgcd求逆元)

    题目链接:codeforces 492e vanya and field 留个扩展gcd求逆元的板子. 设i,j为每颗苹果树的位置,因为gcd(n,dx) = 1,gcd(n,dy) = 1,所以当走 ...

  4. Codeforces 677D Vanya and Treasure 暴力+BFS

    链接 Codeforces 677D Vanya and Treasure 题意 n*m中有p个type,经过了任意一个 type=i 的各自才能打开 type=i+1 的钥匙,最初有type=1的钥 ...

  5. CodeForces 552C Vanya and Scales

    Vanya and Scales Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u S ...

  6. Codeforces 677C. Vanya and Label 位操作

    C. Vanya and Label time limit per test:1 second memory limit per test:256 megabytes input:standard i ...

  7. CodeForces - 552E Vanya and Brackets

    Vanya and Brackets Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u ...

  8. codeforces C. Vanya and Scales

    C. Vanya and Scales Vanya has a scales for weighing loads and weights of masses w0, w1, w2, ..., w10 ...

  9. codeforces 492B. Vanya and Lanterns 解题报告

    题目链接:http://codeforces.com/problemset/problem/492/B #include <cstdio> #include <cstdlib> ...

随机推荐

  1. Java JDK环境配置及说明

    一.Java程序运行机制 Java语言编写的程序需要经过编译生成与平台无关的字节码(.class文件). 这种字节码必须使用Java解释器(JVM)来解释执行. JVM是可运行Java字节码文件的虚拟 ...

  2. JavaScript秘密

    对象 对象使用和属性 JavaScript 中所有变量都可以当作对象使用,除了两个例外 null 和 undefined. false.toString(); // 'false' [1, 2, 3] ...

  3. 分享知识-快乐自己:Maven 相关原理

    依赖原则:解决模块工程之间的Jar冲突问题 1):情定设定:验证路径最短者优先原则 创建三个工程如下: Hello:并且以来 log4j.1.2.17.jar HelloFriend:依赖了工程 He ...

  4. Linux-tcpdump command

    简介 用简单的话来定义tcpdump,就是:dump the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具. tcpdump可以将网络中传送的数据包的 ...

  5. Convolutional Neural Networks for Visual Recognition 5

    Setting up the data and the model 前面我们介绍了一个神经元的模型,通过一个激励函数将高维的输入域权值的点积转化为一个单一的输出,而神经网络就是将神经元排列到每一层,形 ...

  6. mongodb与mysql的命令对比

    mongodb与mysql命令对比 传统的关系数据库一般由数据库(database).表(table).记录(record)三个层次概念组成,MongoDB是由数据库(database).集合(col ...

  7. oracle rac的特征

    oracle rac的特征 1. spfile 参数文件需要被所有节点访问,需要放在共享存储上. 2. Redo ThreadRAC 环境下有多个实例,每个实例都需要有自己的一套Redo log 文件 ...

  8. mongodb 学习资料

    1 入门 http://www.cnblogs.com/huangxincheng/archive/2012/02/18/2356595.html http://www.cnblogs.com/hoo ...

  9. VIJOS:P1706(舞会)

    描述 Arthur公司是一个等级森严的公司,它们有着严格的上司与下属的关系,公司以总裁为最高职位,他有若干个下属,他的下属又有若干个下属,他的下属的下属又有若干个下属……现接近年尾,公司组织团拜活动, ...

  10. POJ3468(树状数组区间维护)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 89818   ...