A - Vanya and Cubes
2014-12-06 21:53
363 查看
#include <iostream> #include <string.h> #include <stdio.h> #include <cmath> #include <stdlib.h> using namespace std; int main() { int n; while(scanf("%d",&n) != EOF) { if( n == 1) { printf("1\n"); continue; } int cnt = 2; int ans = 1; int now = 1; int res = 1; while( ans < n) { now += cnt++; ans += now; res++; } if(ans == n) printf("%d\n",res); else printf("%d\n",res-1); } return 0; }
相关文章推荐
- Codeforces Vanya and Cubes
- 492A - Vanya and Cubes
- 492A - Vanya and Cubes
- Codeforces Round #280 (Div. 2)A. Vanya and Cubes(简单计算)
- Codeforces Round #280 (Div. 2) A. Vanya and Cubes 水题
- Vanya and Cubes
- Codeforces 492A. Vanya and Cubes 水
- A. Vanya and Cubes
- codeforces——492A——Vanya and Cubes
- Codeforces 492A - Vanya and Cubes (求和公式)
- CF E. Vanya and Brackets(添加一对括号使得表达式的值最大)
- E. Vanya and Brackets(Codeforces Round #308 (Div. 2))
- B. Vanya and Food Processor
- CF 552 C. Vanya and Scales
- Codefroces 280 div2 B. Vanya and Lanterns
- 492B - Vanya and Lanterns
- 【CodeForces】679 B. Bear and Tower of Cubes
- Vanya and Lanterns
- codeforces 677B B. Vanya and Food Processor(模拟)
- Codeforces Round #235 (Div. 2) A. Vanya and Cards