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. 1
Output
  1. 1
Input
  1. 25
Output
  1. 4
Note

Illustration to the second sample:

  1. #include <cstdio>
  2. #include <cmath>
  3. #include <cstring>
  4. #include <ctime>
  5. #include <iostream>
  6. #include <algorithm>
  7. #include <set>
  8. #include <vector>
  9. #include <sstream>
  10. #include <queue>
  11. #include <typeinfo>
  12. #include <fstream>
  13. typedef long long ll;
  14. using namespace std;
  15. //freopen("D.in","r",stdin);
  16. //freopen("D.out","w",stdout);
  17. #define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
  18. int main()
  19. {
  20. int n;
  21. cin>>n;
  22. int ans=;
  23. int kill=;
  24. int sum=;
  25. while(ans<=n)
  26. {
  27. sum+=kill;
  28. ans+=sum;
  29. kill++;
  30. }
  31. cout<<kill-<<endl;
  32. return ;
  33. }

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. https://www.yunpanjingling.com/

    https://www.yunpanjingling.com/ 账号  kein20 passwd a1234

  2. skb_pull skb_push skb_put

    unsigned char *skb_pull(struct sk_buff *skb, int len)该函数将 data 指针向数据区的末尾移动,减少了len 字段的长度.该函数可用于从接收到的数 ...

  3. SDN核心技术剖析和实战指南---读书笔记

    第一章 SDN定义如下: SDN是一种新兴的基于软件的网络架构及技术,其最大的特点在于具有松耦合的控制平面与数据平面.支持集中化的网络状态控制.实现底层网络设施对上层应用的透明. SDN和NFV: O ...

  4. 关于一些问题的解决办法[记录]TF400017

    这个问题是今天在改东西的时候,突然断电导致的,google了很久之后,终于找到了办法 方法: 就是删除下面这个文件 -========================================= ...

  5. C++之插入迭代器

    #include<iostream> #include<vector> #include<list> #include<iterator> usingn ...

  6. Filebeat入门

    一.安装filebeat 简介 Beats 是安装在服务器上的数据中转代理. Beats 可以将数据直接传输到 Elasticsearch 或传输到 Logstash . Beats 有多种类型,可以 ...

  7. web项目引入extjs小例子

    一个新的项目,前端用extjs实现!分享一下extjs开发的准备工作! 首先去下载extjs的资源包,这里我是随便在网上下载的! 打开之后 ,目录是这样的! 需要关注的几个文件夹: builds:压缩 ...

  8. jmock2.5 基本教程

    目录 第0章 概述 第1章 jmock初体验 第2章 期望 第3章 返回值 第4章 参数匹配 第5章 指定方法调用次数 第6章 指定执行序列 第7章 状态机 第0章 概述 现在的dev不是仅仅要写co ...

  9. Zookeeper介绍及安装部署

    本节内容: Zookeeper介绍 Zookeeper特点 Zookeeper应用场景 用到了Zookeeper的一些系统 Zookeeper集群安装部署 一.Zookeeper介绍 是一个针对大型分 ...

  10. 一步一步学习IdentityServer3 (13) 令牌

    IdentityServer3中客户端保护了授权资源,不难看出在IdentityServer3中,有这样一个设置 AllowedScopes = new List<string> { &q ...