Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const qA, qB, qC = 200, 300, 500
const pA, pB, pC = 380, 550, 850
const dA, dB, dC = 5, 4, 3

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		q, _ := strconv.Atoi(stdin.Text())
		if q == 0 {
			break
		}

		// A 0袋から始める
		curPrice, newPrice := 0, 0
		// B
		for a := 0; a <= int(q/qA); a++ {
			for b := 0; b <= int((q-qA*a)/qB); b++ {
				// 残り
				rem := q - qA*a - qB*b
				if rem == 0 || ((rem > 0) && ((rem % qC) == 0)) {
					// ちょうど買える
					newPrice = amount(a, b, int(rem/qC))
					if curPrice == 0 || newPrice < curPrice {
						// println(a, b, int(rem/qC), newPrice)
						curPrice = newPrice
					}
				}
			}
		}
		fmt.Println(curPrice)
	}
}

func amount(a, b, c int) int {
	tA := int(float64(int(a/dA)*dA*pA)*0.8) + (a%dA)*pA
	tB := int(float64(int(b/dB)*dB*pB)*0.85) + (b%dB)*pB
	tC := int(float64(int(c/dC)*dC*pC)*0.88) + (c%dC)*pC
	// println("amount:", a, b, c, tA, tB, tC, tA+tB+tC)
	return tA + tB + tC
}

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

const int MAX_WEIGHT = 5000;
const int MIN_WEIGHT = 500;

struct Comodity{
	int weight, price, unit;
	double rate;
};

Comodity com_list[] = {
	{ 200, 380, 5, 0.8 },
	{ 300, 550, 4, 0.85 },
	{ 500, 850, 3, 0.88 },
};

enum{
	A,
	B,
	C,
};

int quantity( int remain, int unit_weight ){
	return remain > 0 ? remain / unit_weight + ( remain % unit_weight ? 1 : 0 ) : 0;
}

int calcPrice( int a, int b, int c ){
	int dis_a = a / com_list[ A ].unit * com_list[ A ].unit;
	int dis_b = b / com_list[ B ].unit * com_list[ B ].unit;
	int dis_c = c / com_list[ C ].unit * com_list[ C ].unit;
	a -= dis_a;
	b -= dis_b;
	c -= dis_c;
	return ( a * com_list[ A ].price ) + ( b * com_list[ B ].price ) + ( c * com_list[ C ].price )
		+ (int)( dis_a * com_list[ A ].price * com_list[ A ].rate )
		+ (int)( dis_b * com_list[ B ].price * com_list[ B ].rate )
		+ (int)( dis_c * com_list[ C ].price * com_list[ C ].rate );
}

int main()
{
	int weight;

	while( cin >> weight && weight ){
		int best_price = INT_MAX;
		int remain_a = weight;
		int a = quantity( remain_a, com_list[ A ].weight );
		for( ; a >= 0; --a ){
			int remain_b = remain_a - a * com_list[ A ].weight;
			int b = quantity( remain_b, com_list[ B ].weight );
			for( ; b >= 0; --b ){
				int remain_c = remain_b - b * com_list[ B ].weight;
				int c = quantity( remain_c, com_list[ C ].weight );
				best_price = min( best_price, calcPrice( a, b, c ) );
			}
		}
		cout << best_price << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <climits>

using namespace std;

struct Tag {
    int amount;
    int cost;
    Tag(int a, int c) : amount(a), cost(c) {}
};
Tag BASE[] = {
    Tag(2, 380), Tag(3, 550), Tag(5, 850),
    Tag(2*5, 380*5*80/100), Tag(3*4, 550*4*85/100), Tag(5*3, 850*3*88/100)
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    while(true) {
        int N;
        cin >> N;
        if(!N) break;
        vector<int> dp(N/100 + 1, INT_MAX/2);
        dp[0] = 0;
        for(int i = 0; i <= N/100; ++i) {
            for(int j = 0; j < 6; ++j) {
                int prev = i - BASE[j].amount;
                if(prev >= 0) {
                    dp[i] = min(dp[i], dp[prev] + BASE[j].cost);
                }
            }
        }
        cout << dp[N/100] << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>

using namespace std;

/*
200 380
300 550
500 850
1000 1520
1200 1870
1500 2244
*/

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector< vector<int> > dp(5000+1, vector<int>(6+1, 1000000));
		int w[6] = {200, 300, 500, 1000, 1200, 1500};
		int v[6] = {380, 550, 850, 1520, 1870, 2244};
		dp[0][0] = 0;
		dp[200][1] = 380;
		dp[300][2] = 550;
		dp[500][3] = 850;
		dp[1000][4] = 1520;
		dp[1200][5] = 1870;
		dp[1500][6] = 2244;
		for (int i = 0; i < 6; i++) {
			for (int j = 0; j <= n; j+=100) {
				if (j < w[i]) {
					dp[j][i+1] = dp[j][i];
				} else {
					dp[j][i+1] = min(dp[j][i], dp[j-w[i]][i+1]+v[i]);
				}
			}
		}
		cout << dp[n][6] << endl;
	}
	return 0;
}

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

using namespace std;

const int w[] = {2, 3, 5, 10, 12, 15};
const int v[] = {380, 550, 850, 1520, 1870, 2244};
const int num = 6;
int dp[55];

int main()
{
    int m;

    for (int i = 0; i <= 50; i++) 
        dp[i] = 50000;

    dp[0] = 0;
    for (int i = 0; i < num; i++)
        for (int j = 0; j + w[i] <= 50; j++)
            dp[j + w[i]] = min(dp[j + w[i]], dp[j] + v[i]);

    while (cin >> m, m) {
        m = m / 100;
        cout << dp[m] << endl;;
    }

    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int dp[200];
signed main(void) {
  REP(i, 200) dp[i] = INF;
  REP(i, 50) REP(j, 50) REP(k, 50) {
    int tmp = i * 2 + j * 3 + k * 5,
        ret = i / 5 * 5 * 304 + (i % 5) * 380 + j / 4 * 4 * 550 * 0.85 +
              (j % 4) * 550 + k / 3 * 3 * 850 * 0.88 + (k % 3) * 850;
    if(tmp <= 50) {
      if(dp[tmp] > ret) cout << i << " " << j << " " << k << " " << tmp << " " << ret << endl;
      dp[tmp] = min(dp[tmp], ret);
    }
  }
  FOR(i, 5, 51) cout << i << " " << dp[i] << endl;

  int n;
  while(1) {
    cin >> n;
    if(n == 0) break;
    cout << dp[n/100] << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
        int N;
        while(cin>>N,N){
                int ans=INT_MAX;
                for (int i = 0; i*500 <= N; i++) {
                        for (int j = 0; i*500+j*300 <= N; j++) {
                                if(!((N-i*500-j*300)%200)){
                                        int k=(N-i*500-j*300)/200;
                                        int ans2=0;
                                        ans2+=(k%5)*380;
                                        ans2+=(k/5)*1520;
                                        ans2+=(j%4)*550;
                                        ans2+=(j/4)*1870;
                                        ans2+=(i%3)*850;
                                        ans2+=(i/3)*2244;
                                        ans=min(ans,ans2);
                                }
                        }
                }
                cout<<ans<<endl;
        }
        return 0;
}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	while(1) {
		int m;
		cin >> m;
		if(m == 0) break;
		m /= 100;
		int ret = INT_MAX;
		rep(i,m/2+1) {
			rep(j,m/3+1) {
				rep(k,m/5+1) {
					if(i * 2 + j * 3 + k * 5 == m) {
						int sum = 0;
						sum += i * 380 + j * 550 + k * 850;
						sum -= i / 5 * (int) (380 * 5 * 0.2) + j / 4 * (int) (550 * 4 * 0.15)
							+ k / 3 * (int) (850 * 3 * 0.12);
						if(sum < ret) {
							ret = sum;
						}
					}
				}
			}
		}
		cout << ret << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace	std;
int main(){
  for(int n;cin>>n&&n;){
    int r=1e9;
    for(int c0=0;c0<=25;c0++)
      for(int c1=0;c1<=16;c1++)
        for(int c2=0;c2<=10;c2++)
          for(int c3=0;c3<=5;c3++)
            for(int c4=0;c4<=4;c4++)
              for(int c5=0;c5<=3;c5++)
                if(n==c0*200+c1*300+c2*500+c3*1000+c4*1200+c5*1500) r=min(r,c0*380+c1*550+c2*850+c3*1520+c4*1870+c5*2240);
    cout<<r<<endl;
  }
  return 0;
}