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 _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][66];

int main(){
    REP(i,66){
        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,66){
            REP(j,66){
                REP(k,66){
                    if(i+j+k < n) continue;
                    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 <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int v, dp[5001];
const int m[] = {200, 300, 500, 1000, 1200, 1500};
const int p[] = {380, 550, 850, 1520, 1870, 2244};
const int INF = 10000000;

/*
  @ツ残ツづィツづ個重ツつウ
*/

int dfs(int w) {
  if (w <= 0) return 0;
  if (dp[w] >= 0) return dp[w];
  int res = INF;
  rep(i,6) {
    if (w-m[i] < 0) continue;
    res = min(res, dfs(w-m[i]) + p[i]);
  }
  return dp[w] = res;
}

void solve() {
  memset(dp, -1, sizeof dp);
  cout<<dfs(v)<<endl;
  //cout<<dp[v]<<endl;
}

int main (int argc, char const* argv[]) {
  /*
  rep(i,5001) dp[i] = INF;
  
  dp[0] = 0;
  rep(z,6) for(int i=0;i+m[z]<5001;i++) {
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }
  rep(i,5001) rep(z,6) {
    if (i+m[z] >= 5001) continue;
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }
  */

  while (cin>>v, v) {
    solve();
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
    while(1){
      int n;
      cin >> n;
      if(n==0) break;
      int min = 1000000;
      int fee;
      for(int a=0;a<=n/200+1;a++){
	for(int b=0;b<=n/300+1;b++){
	  for(int c=0;c<=n/500+1;c++){
	    if(a*200+b*300+c*500==n){
	      fee=a*380+b*550+c*850;
	    if(a>=5) fee+=((a/5)*5*380)*0.8-(a/5*5*380);
	  if(b>=4) fee+=((b/4)*4*550)*0.85-(b/4*4*550);
	if(c>=3) fee+=((c/3)*3*850)*0.88-(c/3*3*850);
      if(min>fee) min=fee;
	    }

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

int w[]={2,3,5,10,12,15};
int v[]={380,550,850,1520,1870,2244};
 
int dp[50+1];
void solve(){
    for(int i=0;i<51;i++){
        dp[i]=INT_MAX/3;
    }
    dp[0]=0;
    for(int i=0;i<6;i++){
        for(int j=w[i];j<=50;j++){
            dp[j]=min(dp[j],dp[j-w[i]]+v[i]);
        }
    }
}
 
int main(){
    solve();
    int n;
    while(cin>>n){
        if(n==0)break;
        n/=100;
        cout<<dp[n]<<endl;
    }
  return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int grum[3]={200,300,500};
int val[3]={380,550,850};
double dis[3]={0.8,0.85,0.88};
int dis_c[3]={5,4,3};

int main()
{
	int ans[5001];
	for(int i = 500; i < 5100; i+=100)
	{
		ans[i]=INT_MAX;
		for(int j = 0; j <= 25; ++j)
		{
			for(int k = 0; k <= 17; ++k)
			{
				for(int l = 0; l <= 10 ; ++l)
				{
					if(j*200+k*300+l*500<i)
					{
						continue;
					}
					int tmp=0;
					tmp+=(j-j%5)*380*0.8+j%5*380;
					tmp+=(k-k%4)*550*0.85+k%4*550;
					tmp+=(l-l%3)*850*0.88+l%3*850;
					ans[i]=min(ans[i],tmp);
				}
			}
		}
	}
	int n;
	while(cin>>n,n) 
	{
		cout<<ans[n]<<endl;
	}
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define INF ( 1 << 25 )
int main(){
  int n, dp[5001];
  const int price[] = { 380, 550, 850, 1520, 1870, 2244};
  const int more[] = { 200, 300, 500, 1000, 1200, 1500};
  fill_n( dp, 5001, INF);
  dp[0] = 0;
  for(int i = 0 ; i < 5001 ; i++ ){
    for(int j = 0 ; j < 6 ; j++ ){
      if(i + more[j] < 5001) dp[i + more[j]] = min( dp[i + more[j]], dp[i] + price[j]);
    }
  }
  while(cin >> n , n) cout << dp[n] << endl;
}