Go: package main

import (
    "fmt"
    "math"
)

func main() {
    var e int
    for {
        fmt.Scan(&e)
        if e == 0 { break }

        var ans float64 = float64(e)
        for z := 0; z <= 101; z++ {
            for y := 0; y <= 1001; y++ {
                x := e - y*y - z*z*z
                if (0 <= x && x <= 100000) {
                  ans = math.Min(ans, float64(x+y+z));
                }
            }
        }
        fmt.Println(ans)
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30

using namespace std;
typedef long long ll;

int main()
{
    int n;
    while(cin >> n && n) {
        int ans = INF;
        rep(i,101) {
            if(i*i*i > n) break;

            rep(j,100) {
                if(i*i*i + j*j > n) break;
                ans = min(ans,i+j+(n - i*i*i - j*j));
            }
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int x,y,z;
int e;
int solve(){
	int minsum = 1000000;
	for (z=0;z<=e;z++)
	{
		for(y=0;y<=e;y++)
		{
				for(x=0;x<=e;x++)
				{
					if(x+y*y+z*z*z == e)
					{
						int temp = x+y+z;
						minsum = min(minsum,temp);
					}
				}
		}
	}
	return minsum;
};
int main(){
	int A[100000];
    int k = 0;
	while( cin>>e && e>0 )
	{
		A[k]=solve();
        k++;
	}
	for(int l = 0;l < k; l++)
    {
        cout<<A[l]<<endl;
    }
	return 0;
}