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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int buy_A(int n){
	return 380*(n-n%5)*0.80 + 380 * (n%5);
}

int buy_B(int n){
	return 550*(n-n%4)*0.85 + 550 * (n%4);
}

int buy_C(int n){
	return 850*(n-n%3)*0.88 + 850 * (n%3);
}

int main(){

	int**** dp = new int***[25+1];
	for(int i=0;i<=25;i++){
		dp[i] = new int**[17+1];
		for(int j=0;j<=17;j++){
			dp[i][j] = new int*[10+1];
			for(int k=0;k<=10;k++){
				dp[i][j][k] = new int[50+1];
			}
		}
	}

	for(int i=0;i<=25;i++){
		for(int j=0;j<=17;j++){
			for(int k=0;k<=10;k++){
				for(int l=0;l<=50;l++){
					dp[i][j][k][l] = 100000000;
				}
			}
		}
	}

	dp[0][0][0][0] = 0;

	for(int a=0; a<=25;a++){
		for(int b=0; b<=17;b++){
			for(int c=0; c<=10;c++){
				for(int w=0; w<=50; w++){
					if(w - a*2 >= 0){
						dp[a][b][c][w] = min(dp[a][b][c][w],dp[0][b][c][w-a*2]+buy_A(a));
					}
					if(w - b*3 >= 0){
						dp[a][b][c][w] = min(dp[a][b][c][w],dp[a][0][c][w-b*3]+buy_B(b));
					}
					if(w - c*5 >= 0){
						dp[a][b][c][w] = min(dp[a][b][c][w],dp[a][b][0][w-c*5]+buy_C(c));
					}
				}
			}
		}
	}

	int W;
	while(~scanf("%d",&W)){
		if(W==0) break;
		W/=100;
		int res=100000000;
		for(int i=0;i<=25;i++){
			for(int j=0;j<=17;j++){
				for(int k=0;k<=10;k++){
					for(int w=W;w<=50;w++){
						res=min(res,dp[i][j][k][w]);
					}
				}
			}
		}
		cout << res << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i,0,n);
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n, m)
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;

#define Rep(i) for(int i  =1; i <= 30; i++)
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;


int main(){
	pii p[6];
	p[0] = mp(2, 380);
	p[1] = mp(3, 550);
	p[2] = mp(5, 850);
	p[3] = mp(2*5, 380*5*0.8);
	p[4] = mp(3*4, 550*4*0.85);
	p[5] = mp(5*3, 850*3*0.88);

	int dp[100];
	int w;
	while(cin>>w&&w){
		w/=100;
		for(int i = 0; i <= w; i++){
			dp[i] = INF;
		}
		dp[0]=0;
		for(int i = 0; i < 6; i++){
			for(int j = p[i].fi; j <= w; j++){
				dp[j]=min(dp[j], dp[j-p[i].fi]+p[i].se);
			}
		}
		cout<<dp[w]<<endl;
	}
}

C++: 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < (k+n); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t)       for(int i = f; i < t; i++)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v)           memset(m, v, sizeof(m))
#define mp                  make_pair
#define pb                  push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 

typedef long long ll;
typedef unsigned long long ull;

#define X real()
#define Y imag()
typedef double D;
typedef complex<D> P;
#define EPS (1e-9)

#ifdef _DEBUG
template<class _T>
inline void _prfe(const char *_n, _T _c, bool _p = false){
    ITER(_c) _it=_c.begin();
    if(_p){ cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<"    "<<*_it<<endl;cout<<"]"<<endl; }
    else{ cout<<_n<<" = [ "<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;cout<<" ]"<<endl; }
}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif

int t[3][51];

int main(){
    REP(i,51){
        int n1 = (i+1)/2, w1 = n1/5*5; t[0][i] = w1*380*80/100 + (n1-w1)*380;
        int n2 = (i+2)/3, w2 = n2/4*4; t[1][i] = w2*550*85/100 + (n2-w2)*550;
        int n3 = (i+4)/5, w3 = n3/3*3; t[2][i] = w3*850*88/100 + (n3-w3)*850;
    }

    int n;
    while(cin >> n && n){
        n /= 100;
        int min = INT_MAX;
        REP(i,n+1){
            REP(j,n+1){
                int k = n-j-i;
                if(k < 0) break;
                min = MIN(min, t[0][i] + t[1][j] + t[2][k]);
                pf("%d:%d:%d / %d+%d+%d / %d\n", i, j, k, t[0][i], t[1][j], t[2][k], min);
            }
        }
        cout << min << endl;
    }
    return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int dp[100];
	for (int i = 0; i < 100; ++i) {
		dp[i] = 1e9;
	}
	dp[0] = 0;
	for (int i = 0; i <= 50; ++i) {
		dp[i + 2] = min(dp[i + 2], dp[i] + 380);
		dp[i + 3] = min(dp[i + 3], dp[i] + 550);
		dp[i + 5] = min(dp[i + 5], dp[i] + 850);
		dp[i + 10] = min(dp[i + 10], dp[i] + 380 * 4);
		dp[i + 12] = min(dp[i + 12], dp[i] + 1870);
		dp[i + 15] = min(dp[i + 15], dp[i] + 2244);
	}
	while (1) {
		int N; cin >> N;
		if (!N)break;
		N /= 100;
		cout << dp[N] << endl;
	}
	return 0;
}