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 <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
int main()
{
int n;
cin>>n;
int ans=;
int kill=;
int sum=;
while(ans<=n)
{
sum+=kill;
ans+=sum;
kill++;
}
cout<<kill-<<endl;
return ;
}

Codeforces Round #280 (Div. 2) A. Vanya and Cubes 水题的更多相关文章

  1. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

  2. Codeforces Round #280 (Div. 2)E Vanya and Field(简单题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 本场题目都比较简单,故只写了E题. E. Vanya and Field Vany ...

  3. Codeforces Round #280 (Div. 2) E. Vanya and Field 思维题

    E. Vanya and Field time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. Codeforces Round #308 (Div. 2) D. Vanya and Triangles 水题

    D. Vanya and Triangles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55 ...

  5. Codeforces Round #355 (Div. 2) C. Vanya and Label 水题

    C. Vanya and Label 题目连接: http://www.codeforces.com/contest/677/problem/C Description While walking d ...

  6. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  7. Codeforces Round #280 (Div. 2) A B C 暴力 水 贪心

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

  8. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  9. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

随机推荐

  1. Oracle基础结构认知—初识oracle【转】

    Oracle服务器(oracle server)由实例和数据库组成.其中,实例就是所谓的关系型数据库管理系统(Relational Database Management System,RDBMS), ...

  2. 打包egg

    scrapyd-deploy -p chahao -v 1.0 --build-egg chahao.egg

  3. 微信web开发者工具无法打开的解决方法

    参考网址:https://blog.csdn.net/gz506840597/article/details/77915488 我试了上面兄弟说的方法还是无效 下面说说我的方法: 我打开文件所在位置, ...

  4. http://s22.app1105796624.qqopenapp.com/

    http://s22.app1105796624.qqopenapp.com/ http://121.43.114.69/xiyou/app/js/ac_tx.js http://hiyouba.co ...

  5. Linux 获取网关地址

    route命令的用法:操作或者显示IP路由表route:DESCRIPTION Route manipulates the kernel's IP routing tables. Its primar ...

  6. JQuery怎么实现页面左侧菜单刷新后保留鼠标点击addclass的样式?

    $('ul.main-menu li a').each(function(){ if($($(this))[0].href==String(window.location)) $(this).pare ...

  7. node项目中用到的一些模块

    1.http模块,用来搭建服务器 代码,简单服务器实现 var http = require('http'); http.createServer(function (request, respons ...

  8. 链家2018春招C/C++开发实习生在线考试编程题

    题目一 题解:该题目意思就是让你输入n组数据,然后求并集,利用STL容器set集合的特性:元素不重复存储,我们可以很轻易得出答案 #include <iostream> #include ...

  9. Python学习笔记:个税起征点上调至5000,算一算少交多少税?

    一.旧税率表与新税率表比较 以前起征点是3500,2018年10月1日起起征点正式修改为5000,下面我们用Python来分别计算新旧个人所得税分别为多少? 二.旧的个人所得税 import sys ...

  10. 站点的安全防范都是后端的职责?非也,Web前端安全同样不可忽视

    前言 随着网络的快速普及,网络安全问题的受害者不再只是政府.企业等集体,每一个接触网络的普通人都有可能成为网络攻击的受害者.随着网络的普及,黑客进行网络攻击的手段越来也多,越来越复杂.以网站的攻击为例 ...