#include <iostream>
#include <algorithm>
using namespace std;
//学好英语 抄博友程序
int main()
{
while(1)
{
int n;
cin>>n;
if(n==0)
{
break;
}
int jg=0;
for(int i=0;i*i*i<=n;i++)//可以为零 等于 抄博友
{
for(int j=0;j*(j+1)*(j+2)/6<=n;j++)
{
if((i*i*i+j*(j+1)*(j+2)/6)<=n)
{
jg=max(jg,i*i*i+j*(j+1)*(j+2)/6);
}
}
}
cout<<jg<<endl;
}
return 0;
}
POJ 1406 Starship Hakodate-maru G++
猜你喜欢
转载自blog.csdn.net/woniupengpeng/article/details/104068743
今日推荐
周排行