Go: package main

import "fmt"

func main() {
	maxGram := 5000
	// store := map[int]int{
	// 	1500: 2244, // 500 * 3
	// 	1200: 1870, // 300 * 4
	// 	1000: 1520, // 200 * 5
	// 	500:  850,
	// 	300:  550,
	// 	200:  380,
	// }

	for {
		var gram int
		fmt.Scanf("%d", &gram)

		if gram == 0 {
			return
		}

		var minPrice int

		// (x * 200) + (y * 300) + (z * 500) == gram
		for x := 0; (x * 200) <= maxGram; x++ {
			for y := 0; (y * 300) <= maxGram; y++ {
				for z := 0; (z * 500) <= maxGram; z++ {
					if (x*200)+(y*300)+(z*500) == gram {
						price := 0
						price += (z / 3) * 2244
						price += (z % 3) * 850
						price += (y / 4) * 1870
						price += (y % 4) * 550
						price += (x / 5) * 1520
						price += (x % 5) * 380

						if price < minPrice || minPrice == 0 {
							minPrice = price
						}
					}
				}
			}
		}

		fmt.Println(minPrice)
	}
}

// 1 袋あたりの量			200g	300g	500g
// 1 袋の単価(定価)		380円	550円	850円
// 割引が適用される単位		5袋毎	4袋毎	3袋毎
// 割引率							20%引き	15%引き	12%引き

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int vol;
    while(cin>>vol){
        int ans=2000000000;
        if(!vol)break;
        vol/=100;
        for(int i=0;i<=50;i++){
            for(int j=0;j<=50;j++){
                for(int k=0;k<=50;k++){
                    if((i+j+k)!=vol)continue;
                    if((i%2)||(j%3)||(k%5))continue;
                    int An=i/2,Bn=j/3,Cn=k/5;
                    //printf("[%d][%d][%d] [%d][%d][%d]\n",i,j,k,An,Bn,Cn);
                    ans=min(ans,An/5*1520+(An%5)*380+Bn/4*1870+(Bn%4)*550+Cn/3*2244+(Cn%3)*850);
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int p[6] = {380,550,850,1520,1870,2244};
int w[6] = {200,300,500,1000,1200,1500};

int dp[5001];

int main(void){
    rep(i,5001) dp[i]=1<<30;
    dp[0]=0;
    rep(i,6){
        loop(j,w[i],5001){
            dp[j]=min(dp[j-w[i]]+p[i],dp[j]);
        }
    }
    int W;
    while(cin>>W,W){
        cout<<dp[W]<<endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int x;
    while(cin >> x, x){
        int ans = INF<int>;
        for (int i = 0; i*200 <= x; ++i) {
            for (int j = 0; i*200+j*300 <= x; ++j) {
                if((x-i*200-j*300)%500) continue;
                int k = (x-i*200-j*300)/500;
                ans = min(ans, i/5*1520+i%5*380+j/4*1870+j%4*550+k/3*2244+k%3*850);
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int g[],int m[],int gg,int mm,int imin){
  int i;
  int mmin=8000;
  if(gg==0)
    return mm;
  else{
    for(i=imin;i<6;i++){
      if(g[i]<=gg)
	mmin=min(f(g,m,gg-g[i],mm+m[i],i),mmin);
    }
  }
  return mmin;
}
int main(){
  int gg;
  int g[6]={1500,1200,1000,500,300,200};
  int m[6]={2244,1870,1520,850,550,380};
  for(;;){
    cin>>gg;
    if(gg==0)
      break;
    cout<<f(g,m,gg,0,0)<<endl;
  }
  return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 1000000


int dp[102];
int main(){
	int N;
	int g[]={2,3,5,10,12,15};
	int v[]={380,550,850,1520,1870,2244};
	VI res;
	REP(i,102)dp[i]=INF;
	dp[0]=0;
	REP(i,49){
		REP(j,6)dp[i+g[j]]=min(dp[i]+v[j],dp[i+g[j]]);
	}
	while(cin>>N&&N!=0){
		res.PB(dp[N/100]);
	}
	REP(i,SZ(res))cout<<res[i]<<endl;
	return 0;
}

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

//?????????
#define AG 200
#define BG 300
#define CG 500
//?????????
#define AM 380
#define BM 550
#define CM 850
//??????????????????
#define AN 5
#define BN 4
#define CN 3
//??????????????????
#define AP 20
#define BP 15
#define BP 12

int main(){
	int g;
	int a,b,c;
	int total;
	int money,work;
	
	while(1){
	 cin>>g;
	 if(g==0){break;}
	 a=0;b=0;c=0;
	 total=0;money=0;
	 
	 for(c=0;c*CG<=g;c++){
	  for(b=0;c*CG+b*BG<=g;b++){
		total=c*CG+b*BG;
		a=(g-total)/200;
		total+=a*AG;
		if(total!=g){continue;}
		//???????¨????
		work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM;
		if(money<work){money=work;}
	  }
	 }
	 
	 cout<<money<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

int na, nb, nc;
const int inf = INT_MAX;

int solve( int n ) {
    if ( n <= 0 ) {
        int ra = na % 5;
        int rb = nb % 4;
        int rc = nc % 3;
        int nna = na - ra;
        int nnb = nb - rb;
        int nnc = nc - rc;
        return (nna*380)*0.8+380*ra + (550*nnb)*0.85+550*rb + (850*nnc)*0.88+850*rc;
    }
    int answer = inf;
    na ++;
    answer = min( answer, solve( n - 200 ) );
    na --;
    nb ++;
    answer = min( answer, solve( n - 300 ) );
    nb --;
    nc ++;
    answer = min( answer, solve( n - 500 ) );
    nc --;
    return answer;
}

int main() {
    int n;
    while ( cin >> n && n != 0 ) {
        na = nb = nc = 0;
        cout << solve( n ) << endl;
    }
    return 0;
}