/** * Space Coconut Crab (Problem A, Practice Contest for Japan Domestic, 2007-06-24) * by Kenji Inoue, 2007-06-25 **/ #include using namespace std; int main() { int e; while (cin >> e, e) { int min = e; for (int z=0; z*z*z<=e; z++) { for (int y=0; y*y<=e-z*z*z; y++) { int x = e - z*z*z - y*y; if (x + y + z < min) { min = x + y + z; } } } cout << min << endl; } return 0; }