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 <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, 30) REP(j, 20) REP(k, 15) {
    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;
    dp[tmp] = min(dp[tmp], ret);
  }

  int n;
  while(cin >> n) {
    cout << dp[n/100] << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define NUM 6
#define MAX 5000
struct Data{int weight,cost;};
int main()
{
  int n;
  int dp[MAX+1]={0};
  Data item[NUM]={
    {200,380},{300,550},{500,850},{1000,1520},{1200,1870},{1500,2244}
  };
  for(int j=0;j<=MAX;j++)dp[j]=INT_MAX>>2;
  dp[0]=0;
  for(int i=0;i<NUM;i++){
    for(int j=item[i].weight;j<=MAX;j++){
      dp[j] = min( dp[j], dp[j-item[i].weight] + item[i].cost );
    }
  }

  while(cin>>n,n){
    cout<<dp[n]<<endl;
  }
}

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

struct soba{
	double gram;
	double yen;
	soba(double g, double y){gram=g;yen=y;}
};

double n;
double min_y;
vector<soba> v;


void buy(double sum_g, double sum_y){
	int len = v.size();
	for(int i=0;i < len;i++){
		if(sum_g == n){
			min_y = min(min_y, sum_y);
			return;
		}else if(sum_g > n){
			break;
		}
		buy(sum_g+v[i].gram, sum_y+v[i].yen);
	}
	return;
}


int main(){
	int sum_g, sum_y;
	v.push_back(soba(200,380));
	v.push_back(soba(200*5, (380*5) * 0.8));
	v.push_back(soba(300,550));
	v.push_back(soba(300*4, (550*4) * 0.85));
	v.push_back(soba(500,850));
	v.push_back(soba(500*3, (850*3) * 0.88));
	while(true){
		cin>>n; if(n==0) break;
		min_y = DBL_MAX;
		buy(0,0);
		cout<<int(min_y)<<endl;
	}
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
    for(int n, res; res = INF, cin >> n, n /= 100; cout << res << endl)
        for(int c = 0; c <= n; c += 5)
            for(int b = 0, a; (b + c) <= n; b += 3)
                if(!((a = n - b - c) % 2))
                    res = min(res, int((c / 5 * 0.88+ c / 5 % 3 * 0.12) * 850
                                     + (b / 3 * 0.85+ b / 3 % 4 * 0.15) * 550
                                     + (a / 2 * 0.8 + a / 2 % 5 * 0.20) * 380));

    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;
}

C++: #include<iostream>

const int q[3] = { 200, 300, 500 };
const int p[3] = { 380, 550, 850 };
const int b[3] = { 5, 4, 3 };
const double r[3] = { 0.8, 0.85, 0.88 };

int calc( int i, int n )
{
	return n / b[i] * b[i] * p[i] * r[i] + n % b[i] * p[i];
}

int main()
{
	int n;
	while( std::cin >> n, n )
	{
		int ans = 1 << 30;

		for( int a = 0; a <= 25; ++a )
		{
			for( int b = 0; b <= 16; ++b )
			{
				for( int c = 0; c <= 10; ++c )
				{
					int price = calc( 0, a ) + calc( 1, b ) + calc( 2, c );
					int w = a * q[0] + b * q[1] + c * q[2];

					if( w == n )
						ans = std::min( ans, price );
				}
			}
		}

		std::cout << ans << std::endl;
	}

	return 0;
}