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 <stdio.h>
#include <math.h>

int main(void){
	int y, z, e, min;
	while(1){
		scanf("%d",&e);
		if(e == 0)
			break;
		min = 0x7FFFFFFF;
		for(z = 0;pow((double)z,3) <= e;z++){
			for(y = 0;pow((double)z,3) + pow((double)y,2) <= e;y++){
				if(min > z + y + (e - pow((double)z,3) - pow((double)y,2)))
					min = z + y + (e - pow((double)z,3) - pow((double)y,2));
			}
		}
		printf("%d\n",min);
	}
	return 0;
}

C++: //Name: Space Coconut Crab
//Level: 2
//Category: 数学,探索
//Note: 

/**
 * zの範囲は0≦z≦E^(1/3)、yの範囲は0≦y≦E^(1/2)で表される。
 * zとyが決まればxも一意に決まるので、zとyを全探索し、x,y,z≧0を満たすような組み合わせについてx+y+zの最小値を求めればよい。
 *
 * オーダーは O(E^(5/6))。
 */
#include <iostream>
#include <algorithm>

using namespace std;

bool solve(bool first) {
    int E;
    if(!(cin >> E)) return false;
    if(!E) return false;

    int ans = E;
    for(int z = 0; z*z*z <= E; ++z) {
        for(int y = 0; y*y <= E; ++y) {
            const int x = E - z*z*z - y*y;
            if(x >= 0) {
                ans = min(ans, x+y+z);
            }
        }
    }
    cout << ans << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	long long E, sum=1000000;
	int y,z;
	long long x= E-z*z*z-y*y;
	while(1){
	cin >> E;
	if(E==0)break;
	for(z=0;z*z*z<=E;z++)
		for(y=0;y*y<=E;y++){
			if(z*z*z+y*y>E)break;
			else if(sum>x+y+z)sum=x+y+z;
			}
		cout << sum << endl;
	}
        return 0;
}

C++: #include <iostream>


using namespace std;

int solve(int n){
  int e = 1e6;
  for (int i = 0; i*i*i < e ; ++i)
  {
    for (int k = 0; k*k < e - i*i*i; ++k)
    {
      e = min(e, n-i*i*i-k*k+i+k);
    }
  }
  return e;
}


int main(){
  int n;
  while(true){
    cin >> n;
    if (n == 0)
    {
      break;
    }
    cout << solve(n) << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1,2,0,-2,0};
const int dy[]={0,1,-1,0,1,1,-1,-1,0,2,0,-2};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef pair<int,int> Pii;
typedef pair<int,Pii > P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
int main(){
	int e;
	while(scanf("%d",&e),e){
		int ans = INF;
		rep(y,1000){
			rep(z,100){
				int Y = y*y;
				int Z = z*z*z;
				if(Y+Z > e)continue;
				ans = min(ans,e-Y-Z+y+z);
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

int solve(int E){
    int ans = 1000000;
    for (int y = 0; y*y <= E; ++y){
        for (int z = 0; z*z*z <= E; ++z){
            int x = E - y*y - z*z;
            ans = min(ans, x+y+z);
        }
    }
    return ans;
}
    

int main(){
    int E;
    while (cin >> E && E>0) {
        cout << solve(E) << endl;
    }
}

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,1001) {
                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++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#include <string>
using namespace std;

//宣言
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//数値
#define MOD 1000000007
#define INF (1<<20)
const double EPS = 1e-10;
const double PI = acos(-1.0);

//操作
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define REPB(i,n) for(int i=n;i>=0;--i)
#define SORT(A) sort(A,A+sizeof(A)/sizeof(A[0]))
#define VSORT(A) sort(A.begin(),A.end())
#define EXIST(s,e) (s.find(e)!=s.end())
#define PB push_back
#define MP make_pair
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

//DEBUG
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main() {
	int e=1;
	do {
		scanf("%d", &e);
		if (e == 0) break;
		int x=0, y=0, z=e;
		int m = x + y + z;
		for (z = 100;z >= 0;z--) {
			for (y = 1000;y >= 0;y--) {
				x = e - z*z*z - y*y;
				if (x >= 0 && x + y + z < m) m = x + y + z;
			}
		}
		cout << m << endl;
	} while (e != 0);

}

C++: #include <iostream>
#include <cmath>
using namespace std;
int E;
int main(){
  while(cin >> E && E>0){
    int m = 500;
    for (int z=0; z<=cbrt(E); z++){
      if(z >= m) break;
      for(int y=0; y<= sqrt(E-pow(z,3));y++){
	 if (y+z >= m) break;
	    int x = E - pow(z,3) - pow(y,2);
	    if (x >= 0){
	      if(x+y+z < m){
		m = x+y+z;
	      }
	    }
      }
    }
    cout << m << endl;
  }
}

C++: #include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
#undef vo

int main() {
	for (int e, m; (e = m = in());) {
		for (int z = cbrt(e) + 0.0001; z >= 0; z--) {
			int te = e - z * z * z;
			int y = (int)sqrt(te);
			int tm = z + y + te - y * y;
			if (z + y > m)
				break;
			m = min(m, tm);
		}
		out(m, '\n');
	}
}

C++: #include<iostream>
using namespace std;

int main(){
  while(1){
  int e,min=100000000,ans;
 cin>>e;
 if(e==0) break;
 for(int i=0;i<=e;i++){
   for(int j=0;j<=e;j++){
     ans=e-(i*i+j*j*j);
     if(min>ans+j+i && e>=ans && ans>=0) min=ans+i+j;
   }
 }
 cout<<min<<endl;
  }
 return 0;
}

C++: #include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)

int main() {
	int E;
	while(cin>>E&& E>0){
		int j,k,m;
		m = 10000000;
		for(j = 0; j*j<=100000;j++){
			for(k=0;k*k*k<=100000;k++){
				int i = E - j*j - k*k*k;
				int sum = i+j+k;
				if(m>sum && i >=0){
					m = sum;
				}
			}
		}
		cout<<m<<endl;
	}
	return 0;
}