Codeforces Vanya and Cubes
来源:互联网 发布:js 设置radio checked 编辑:程序博客网 时间:2024/06/15 12:13
import java.util.Scanner;public class VanyaAndCubes {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int n = scanner.nextInt();int count = 0;for(int i =1; ; i++) {int level = add(i);if(n >= level) {count++;n -= level;} else {break;}}System.out.println(count);}public static int add(int k) {int sum = 0;for(int i = 1; i <=k ;i++) {sum += i;}return sum;}}
阅读全文
0 0
- Codeforces Vanya and Cubes
- Codeforces 492A. Vanya and Cubes 水
- Codeforces 492A Vanya and Cubes(水)
- CodeForces 492A Vanya and Cubes
- Codeforces 492A Vanya and Cubes【水题】
- A. Vanya and Cubes
- A - Vanya and Cubes
- Vanya and Cubes
- CodeForces 492A Vanya and Cubes(水题)
- codeforces——492A——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(简单计算)
- Codefroces 280 div2 A. Vanya and Cubes
- CF 280A. Vanya and Cubes(div2)
- codeforces Vanya and Lanterns
- codeforces Vanya and Cards
- 那些让人一见钟情的网页首屏,遵循着怎样的设计模式?
- 【排序算法】 堆排序 heap sort(选择类排序)
- Linux 下安装Cmake操作步骤
- 个人学习(十二)
- 【用Python学习Caffe】5. 生成solver文件
- Codeforces Vanya and Cubes
- 比CycleGAN更强的非监督GAN----DistanceGAN
- 亲测有效 Adobe PhotoShop CS6 for Mac(苹果)中文破解版下载及破解方法
- 方法的值传递和引用传递
- 关于Paint了解text绘制时的基线位置关系/测量字符的宽度
- 用Total Control在电脑操作手机
- java正则表达式
- 是否同构
- Java的InputStream和OutPutStream流输入与输出体会