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<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 += a * 380 * 4 / 5  + aa * 380;
  ret += b * 550 * 17 / 20 + bb * 550;
  ret += c * 850 * 22 / 25 + cc * 850;
  return ret;
}

int main(){
  int n;
  while(cin>>n, n){
    int ans = INT_MAX;
    n /= 100;
    for(int i = 0; i < n + 2; i+=2){
      for(int j = 0; i + j < n + 3; j+=3){
        int k = n - i - j + 4;
        //printf("%d %d %d => %d\n",i/2,j/3,k/5,cost(i/2,j/3,k/5));
        ans = min(ans, cost(i/2,j/3,k/5));
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int dp[4][10000];
int v[3] = { 2,3,5 }, w[3] = { 380,550,850 };

int main() {
	memset(dp, 127, sizeof(dp));
	dp[0][0] = 0;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 9000; j++) {
			for (int k = j; k < 10000; k += v[i]) {
				dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + (k - j) / v[i] * w[i]);
			}
		}
	}
	while (true) {
		int n;
		cin >> n;
		if (n == 0) { break; }
		cout << dp[3][n % 100] << endl;
	}
	return 0;
}

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

using namespace std;

int priceA(int amount){
	if(amount % 200 != 0){ return -1; }
	amount /= 200;
	return (amount / 5 * 5) * 380 * 80 / 100 + (amount % 5) * 380;
}
int priceB(int amount){
	if(amount % 300 != 0){ return -1; }
	amount /= 300;
	return (amount / 4 * 4) * 550 * 85 / 100 + (amount % 4) * 550;
}
int priceC(int amount){
	if(amount % 500 != 0){ return -1; }
	amount /= 500;
	return (amount / 3 * 3) * 850 * 88 / 100 + (amount % 5) * 850;
}

int main(){
	while(true){
		int amount;
		cin >> amount;
		if(amount == 0){ break; }
		int price = INT_MAX;
		for(int a = 0; a <= amount; a += 200){
			for(int b = 0; b + a <= amount; b += 300){
				for(int c = 0; c + b + a <= amount; c += 500){
					if(a + b + c != amount){ continue; }
					int pa = priceA(a), pb = priceB(b), pc = priceC(c);
					price = min(price, pa + pb + pc);
				}
			}
		}
		cout << price << endl;
	}
	return 0;
}

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

const int INF = 1 << 29;

int W;

int main() {
    while (true) {
        cin >> W;
        if (W == 0) break;

        int min_cost[5000];
        fill(min_cost, min_cost+W+1, INF);
        min_cost[0] = 0;

        int g[6] = {200, 300, 500, 1000, 1200, 1500};
        int c[6] = {380, 550, 850, 1520, 1870, 2244};

        for (int j = 0; j < 6; ++j) {
            for (int k = g[j]; k <= W; ++k) {
                min_cost[k] = min(min_cost[k], min_cost[k-g[j]] + c[j]);
            }
        }

        cout << min_cost[W] << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#define INF 1<<28
using namespace std;

int memo[10000];

int solve(int n){
  int res = INF;
  if(!n) return 0;
  if(n < 0) return INF;
  if(memo[n]) return memo[n];
  return memo[n] = res = min(res, min(solve(n-1000)+1520, min(solve(n-1200)+1870, min(solve(n-1500)+2244, min(solve(n-200)+380, min(solve(n-300)+550, solve(n-500)+850))))));
}

int main(){ 
  int n;
  for(int i=0;i<5001;i++) solve(i);
  while(cin >> n, n) cout << memo[n] << endl; 
}

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

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	int answers[64];
	int dp[64][8][4][4];
	
	rep(i, 51){
		answers[i] = 1<<29;
		rep(j, 5) rep(k, 4) rep(l, 3){
			int ans = i+j+k+l ? 1<<29 : 0;
			if(2<=i && j)
				ans = min(ans, dp[i-2][j-1][k][l] + 380);
			if(10<=i && !j)
				ans = min(ans, dp[i-10][0][k][l] + 1520);
			if(3<=i && k)
				ans = min(ans, dp[i-3][j][k-1][l] + 550);
			if(12<=i && !k)
				ans = min(ans, dp[i-12][j][0][l] + 1870);
			if(5<=i && l)
				ans = min(ans, dp[i-5][j][k][l-1] + 850);
			if(15<=i && !l)
				ans = min(ans, dp[i-15][j][k][0] + 2244);
			dp[i][j][k][l] = ans;
			answers[i] = min(answers[i], ans);
		}
	}
	
	int weight;
	while(scanf("%d", &weight), weight){
		printf("%d\n", answers[weight/100]);
	}
	
	return 0;
}

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

int main()
{
    int volumeBuckwheat;
    
    while (std::cin >> volumeBuckwheat) {
        if (volumeBuckwheat == 0) break;
        
        volumeBuckwheat /= 100;
        
        int money = 1000000;
        for (int i = 0; i < 26; ++i) {
            for (int j = 0; j < 17; ++j) {
                for (int k = 0; k < 11; ++k) {
                    if (2 * i + 3 * j + 5 * k == volumeBuckwheat) {
                        money = std::min(money, 
                                         i / 5 * 1520 + i % 5 * 380 +
                                         j / 4 * 1870 + j % 4 * 550 +
                                         k / 3 * 2244 + k % 3 * 850);
                    }
                }
            }
        }
        
        std::cout << money << std::endl;
    }

    return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

#define  N_MAX 5000

int main()
{
	int n;
	while (cin >> n,n) {
		ll ans = INF,num;
		rep(i, N_MAX / 200) {
			rep(j, N_MAX / 300) {
				rep(k, N_MAX / 500) {
					num = 0;
					if (i * 200 + j * 300 + k * 500 != n) continue;
					int a = i - (i / 5)*5;
					int b = j - (j / 4) * 4;
					int c = k - (k / 3) * 3;
					num += a * 380 + (i / 5) * 5 * 380 * 0.8;
					num += b * 550 + (j / 4) * 4 * 550 * 0.85;
					num += c * 850 + (k / 3) * 3 * 850 * 0.88;
					ans = min(ans,num);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}