#include "stdafx.h"
#include <iostream>
#include <cmath>
#define S 30
#define RANGE 1000
int main()
{
long long int a, b, c;
for (a = - RANGE; a <= RANGE; ++a)
{
for (b = a; b <= RANGE; ++b)
{
for (c = b; c <= RANGE; ++c)
{
if (a * a * a + b * b * b + c * c * c == S)
std::cout << a << "," << b << "," << c << std::endl;
}
}
}
return 0;
}
答案是30或33在[-1000, 1000]都没有整数解