现在的位置: 首页 > 综合 > 正文

hdoj 2551

2019年07月31日 ⁄ 综合 ⁄ 共 226字 ⁄ 字号 评论关闭

http://acm.hdu.edu.cn/showproblem.php?pid=2551

//水题
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
 int t, n, x;
 int i, j;
 cin >> t;
 while (t--) {
  cin >> x;
  n = 0; i = 1;
  while (x > 0) {
   n++;
   x = x - pow((double)i,3);
   i++;
  }
  cout << n << endl;
 }
 return 0;
}

 

【上篇】
【下篇】

抱歉!评论已关闭.