Codeforces 492A Vanya and Cubes(水)

来源:互联网 发布:苹果7翻译软件 编辑:程序博客网 时间:2024/06/11 18:31

题目链接:Codeforces 492A Vanya and Cubes

#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main () {int n, s = 0;scanf("%d", &n);for (int i = 1; i; i++) {s += i;if (n < s) {printf("%d\n", i - 1);break;} elsen -= s;}return 0;}


0 0
原创粉丝点击