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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


int m[] = {200, 300, 500};
int p[] = {380, 550, 850};
int d[] = {5, 4, 3};
double r[] = {0.8, 0.85, 0.88};
const int INF = 1 << 30;

int dfs(int k, int rest, double x)
{
    if(rest == 0) return x;
    
    if(k == 3 || rest < 0) return INF;
    
    int res = INF;
    rep(i, 41)
        chmin(res, dfs(k + 1, rest - m[k] * i, x + p[k] * (i - i % d[k]) * r[k] + p[k] * (i % d[k])));
    
    return res;
}

int main()
{
	int v;
	while(cin >> v && v)
        cout << dfs(0, v, 0) << endl;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int g[] = {1500,1200,1000,500,300,200};
int c[] = {2244,1870,1520,850,550,380};

int dp[11][5555];
int solve(int i,int n){
  if(i > 5) return 1<<28;
  if(n <= 0) return 0;
  if(dp[i][n]) return dp[i][n];
  return dp[i][n] = min(solve(i,n-g[i])+c[i],solve(i+1,n));
}

int main(void){
  int n;
  while(cin >> n && n){
    cout << solve(0,n) << endl;
  }
}

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

int main(){
	int weight;
	while(cin >> weight){
		if(weight == 0) break;
		int minimum_cost = 100000000;
		for(int i = 0; (i-1) * 200 < weight; i++){
			int w2 = weight - 200 * i;
			for(int j = 0; (j-1) * 300 < w2; j++){
				int w3 = w2 - 300 * j;
				int k = 0;
				while(k * 500 < w3) k++;
				int cost = (i / 5) * 1520 + (i % 5) * 380
					+ (j / 4) * 1870 + (j % 4) * 550
					+ (k / 3) * 2244 + (k % 3) * 850;
				if(i * 200 + j * 300 + k * 500 == weight)
					minimum_cost = min(minimum_cost, cost);
			}
		}
		cout << minimum_cost << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	int bw[][2]={{2,380},{3,550},{5,850},{10,1520},{12,1870},{15,2244}};
	int dp[51]={0};
	for(int i=0;i<51;++i){
		dp[i]=1e+9;
	}
	for(int i=0;i<51;++i){
		for(int j=0; j<6 ; ++j){
			if(i>=bw[j][0]){
					dp[i]= min(dp[i] , dp[i-bw[j][0]]+bw[j][1]); //dp[i]=((dp[iSize-jSize]+jValue < dp[i]) ? dp[iSize-jSize]+jValue : dp[i]);
			}
		}
	}
	while(cin >> n , n){
		cout << dp[n/100] << endl;
	}
	return 0;
}

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

using namespace std;

int ret;
int w;

void solve(int tmpw, int c){
  //cout << "tmpw = " << tmpw << endl;
  if(c >= ret) return;
  if(tmpw == 0){
	ret = min(ret, c);
	return;
  }
  if(c+850*3*0.88 < ret && tmpw - 1500 >= 0){
	solve(tmpw-1500, c+850*3*0.88);
  }
  if(c+380*5*0.8 < ret && tmpw-1000 >= 0){
	solve(tmpw-1000, c+380*5*0.8);
  }
  if(c+550*4*0.85 < ret && tmpw-1200 >= 0){
	solve(tmpw-1200, c+550*4*0.85);
  }
  if(c+850 < ret && tmpw - 500 >= 0){
	solve(tmpw-500, c+850);
  }
  if(c+550 < ret && tmpw - 300 >= 0){
	solve(tmpw-300, c+550);
  }
  if(c+300 < ret && tmpw - 200 >= 0){
	solve(tmpw-200, c+380);
  }
  
  return;
}

int main(void){
  while(cin >> w && w){
	ret = 1 << 30;
	solve(w,0);
	cout << ret << endl;
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int d[6] = {1500,1200,1000,500,300,200};
int m[6] = {2244,1870,1520,850,550,380};
int s(int i,int n){
  if(i==5){
    if(n%200) return 1e8;
    else return n/d[i]*m[i];
  }
  return min( n/d[i]*m[i]+s(i+1,n%d[i]), s(i+1,n));
}
int main(void){
  int n;
  while(cin>>n){
    if(!n) break;
    cout<<s(0,n)<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
    int G;
    //cin >> G;
    while(1) {
    int ans = 10000000;
    cin >> G;
    if (G==0)break;
    for (int a = 0; a <= 25; ++a){
      for (int b = 0; b <= 16; ++b){
	for (int c = 0; c <= 10; ++c){
	  
	  int k = 200 * a + 300 * b + 500 * c;
	  if (k != G) continue;
	  
	  // cout << a << " " << b << " " << c << endl; 
	  int s = a % 5;
	  int S = a - s;
	  int x = 380 * 0.8 * S + 380 * s;

	  int t = b % 4;
	  int T = b - t;
	  int y = 550 * 0.85 * T + 550 * t;

	  int u = c % 3;
	  int U = c - u;
	  int z = 850 * 0.88 * U + 850 * u;

	  int g = x + y + z;

          //int h[] = {g};
          //int min = h[0];
          //for (int i = 0; i < 10000000; i++){
	  //  if (h[i] < min)
	  //    min = h[i];
	  //}
	  //cout << min << endl;
	  // もしgがansより小さければansをgに書き換える
	  if (g < ans){
	    ans = g;
	      }
	    }
          }
        }
      cout << ans << endl;  
    }
  return 0;
}