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 <bits/stdc++.h>
using namespace std;

/* template {{{ */
/* vim: set foldmethod=marker: */
/* Roadagain {{{ */
/****************************************************************************************/
/*                                                                                      */
/*                                                                                      */
/*                                                                                      */
/*  /#######                            /##                               /##           */
/* | ##__  ##                          | ##                              |__/           */
/* | ##  \ ##  /######   /######   /#######  /######   /######   /######  /## /#######  */
/* | #######/ /##__  ## |____  ## /##__  ## |____  ## /##__  ## |____  ##| ##| ##__  ## */
/* | ##__  ##| ##  \ ##  /#######| ##  | ##  /#######| ##  \ ##  /#######| ##| ##  \ ## */
/* | ##  \ ##| ##  | ## /##__  ##| ##  | ## /##__  ##| ##  | ## /##__  ##| ##| ##  | ## */
/* | ##  | ##|  ######/|  #######|  #######|  #######|  #######|  #######| ##| ##  | ## */
/* |__/  |__/ \______/  \_______/ \_______/ \_______/ \____  ## \_______/|__/|__/  |__/ */
/*                                                    /##  \ ##                         */
/*                                                   |  ######/                         */
/*                                                    \______/                          */
/*                                                                                      */
/****************************************************************************************/
/* }}} */
/* constant {{{ */
const int    INF = (int)1e9;
const int    MOD = (int)1e9 + 7;
const double PI  = acos(-1);
const double EPS = 1e-14;
/* }}} */
/* alias {{{ */
template <class T> using vec = vector<T>;
using ll   = long long;
using ull  = unsigned long long;
using vi   = vec<int>;
using vl   = vec<ll>;
using vd   = vec<double>;
using pii  = pair<int, int>;
using pdd  = pair<double, double>;
using vec2 = complex<double>;
/* }}} */
/* repetition {{{ */
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPIT(i, obj) for (auto i = (obj).begin(); i != (obj).end(); ++i)
#define RREPIT(i, obj) for (auto i = (obj).rbegin(); i != (obj).rend(); ++i)
/* }}} */
/* short {{{ */
#define pb emplace_back
#define mp make_pair
#define fst first
#define sec second
/* }}} */
/* input {{{ */
template <class T = int> inline T in(){ T x; cin >> x; return x; }
template <class T = int> inline vec<T> in(int n){ vec<T> v(n); REP(i, n) v[i] = in<T>(); return v; }
template <class T = int> inline void in(T* x, int n){ REP(i, n) x[i] = in<T>(); }
#define inl in<ll>
#define ind in<double>
#define ins in<string>
/* }}} */
/* container util {{{ */
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLA(ary, n) (ary), ((ary) + (n))
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define SZ(obj) (obj).size()
#define SZA(ary) (sizeof(ary) / sizeof(*ary))
#define SORT(obj) sort(ALL(obj))
#define SORTA(ary, n) sort(ALLA(ary, n))
#define EXIST(obj, key) ((obj).find(key) != (obj).end())
#define CLEARY(ary) memset((ary), 0, sizeof(ary))
/* }}} */
/* print util {{{ */
template <class T> inline void print(const T& x){ cout << x << '\n'; }
template <class T> inline void printd(const T& x, int d){ cout << fixed << setprecision(d) << x << '\n'; }
template <class T> inline void printv(vec<T>& v){ int n = sz(v); REP(i, n) cout << v[i] << "\n "[i < n - 1]; }
template <class T> inline void printv(vec<T>& v, int n){ REP(i, n) cout << v[i] << "\n "[i < n - 1]; }
template <class T> inline void printa(T* ary, int n){ REP(i, n) cout << ary[i] << "\n "[i < n - 1]; }
#define DUMP(x) cerr << #x << ": " << (x) << '\n'
#define DEBUG(x) cerr << #x << ": " << (x) << " (" << __LINE__ << ")" << '\n'
/* }}} */
/* template }}} */

const pii price[] = {
    {2, 380},
    {3, 550},
    {5, 850},
    {10, 1520},
    {12, 1870},
    {15, 2244}
};

signed main()
{
    int w;

    while (w = in(), w){
        int dp[64];
        fill(dp, dp + 64, INF);
        dp[0] = 0;

        w /= 100;
        for (auto& i : price){
            REP(j, w - i.fst + 1){
                dp[j + i.fst] = min(dp[j + i.fst], dp[j] + i.sec);
            }
        }

        print(dp[w]);
    }

    return 0;
}

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

#define Kinds 6
#define DP 50
const int cost[Kinds]={380,550,850,(int)(380*5*0.8),(int)(550*4*0.85),(int)(850*3*0.88)};
const int Volume[Kinds]={200,300,500,1000,1200,1500};

unsigned int dp[DP];

int main(){
	int n;
	
	memset(dp,10000000,sizeof(dp));
	dp[0]=0;
	for(int i=0;i<DP;++i)
		for(int l=0;l<Kinds;++l)
			if(i-Volume[l]/100>=0)
				dp[i]=std::min(dp[i],dp[i-Volume[l]/100]+cost[l]);
	while( std::cin>>n, n )
		std::cout<<dp[n/100]<<std::endl;
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int cost(int a, int b, int c){
  int ret = 0;
  int aa = a % 5; a -= aa;
  int bb = b % 4; b -= bb;
  int cc = c % 3; c -= cc;
  ret += (int)(a * 380 * 0.80 + 0.1) + aa * 380;
  ret += (int)(b * 550 * 0.85 + 0.1) + bb * 550;
  ret += (int)(c * 850 * 0.88 + 0.1) + cc * 850;
  return ret;
}

int main(){
  int n;
  while(cin>>n, n){
    int ans = INT_MAX;
    n += 99;
    n /= 100;
    for(int i = 0; i < n + 25; i+=2){
      for(int j = 0; i + j < n + 25; j+=3){
        for(int k = 0; i + j + k < n + 25; k+=5){
          if(i + j + k >= n)
            ans = min(ans, cost(i/2,j/3,k/5));
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
vector<int> dp  (5001,(1<<21));
vector<int> able(5001,false);

void init(){
	int item[6] = {200,300,500,1000,1200,1500};
	int price[6]= {380,550,850,1520,1870,2244};
	
	able[0]=true;
	dp[0]  =0;

	for(int k=0;k<6;k++){	
		for(int i=0;i+item[k]<=5000;i++){
			dp[i+item[k]] = min( dp[i+item[k]] , dp[i]+price[k] );
		}
	}
}

int main(){
	init();
	int n;
	int mi;
	while(cin >> n && n){
		/*mi = 1<<21;
		for(int i=n;i<=5000;i++){
			mi = min(dp[i],mi);
		}*/	
		cout << dp[n] << endl;
	}
}