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 ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  double ans;
  vary(double,dp,51,0);
  dp[0] = 0;
  dp[1] = inf;
  dp[2] = 380;
  dp[3] = 550;
  dp[4] = 380*2;
  dp[5] = 850;
  dp[6] = 550 * 2;
  REP(i,7,51){
    ans = 380 + dp[i-2];
    ans = min(ans,550 + dp[i-3]);
    ans = min(ans,850 + dp[i-5]);
    if(i >= 10)
      ans = min(ans,dp[i-10] + 380 * 5 * 0.8);
    if(i >= 12)
      ans = min(ans,dp[i-12] + 550 * 4 * 0.85);
    if(i >= 15)
      ans = min(ans,dp[i-15] + 850 * 3 * 0.88);
    dp[i] += ans;
  }
  while(cin>>n&&n){
    cout << dp[n/100] << endl;
  }
  return 0;
}

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

const int INF = 1 << 30;

int gram;
int memo[30][30][30];

int solve(int A, int B, int C)
{
  if (memo[A][B][C] != -1)
    return memo[A][B][C];
  else if (A*200 + B*300 + C*500 > gram)
    return INF;
  else if (A*200 + B*300 + C*500 == gram)
    return A/5*1520 + (A%5)*380 + B/4*1870 + (B%4)*550 + C/3*2244 + (C%3)*850;

  int ret = std::min(solve(A+1, B, C), std::min(solve(A, B+1, C), solve(A, B, C+1)));
  return memo[A][B][C] = ret;
}

int main()
{
  while (~scanf("%d", &gram)) {
    if (gram == 0)
      break;

    for (int i = 0; i < 30; ++i) {
      for (int j = 0; j < 30; ++j) {
	for (int k = 0; k < 30; ++k)
	  memo[i][j][k] = -1;
      }
    }
    printf("%d\n", solve(0, 0, 0));
  }
  return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

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




int main(void){
	int n;
	while(scanf("%d", &n) &&n ){
		int dp[200001] ={0};
		dp[0] = 0;
		
		for(int i = 1; ; i++){
			for(int j = 0; j < 6; j++){
				if(i-price[j] < 0)continue;
				dp[i] = max(dp[i-price[j]]+weight[j],dp[i]);
			}
			if(dp[i]>=n){
				printf("%d\n",i);
				break;
			}
		}
	}
	return 0;
}

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

//?????????
#define AG 200
#define BG 300
#define CG 500
//?????????
#define AM 380
#define BM 550
#define CM 850
//??????????????????
#define AN 5
#define BN 4
#define CN 3
//??????????????????
#define AP 20
#define BP 15
#define CP 12

int main(){
	int g;
	int a,b,c;
	int total;
	int money,work;
	
	while(1){
	 cin>>g;
	 if(g==0){break;}
	 a=0;b=0;c=0;
	 total=0;money=0;
	 
	 for(c=0;c*CG<=g;c++){
	  for(b=0;c*CG+b*BG<=g;b++){
		total=c*CG+b*BG;
		a=(g-total)/200;
		total+=a*AG;
		if(total!=g){continue;}
		//???????¨????
		work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM;
		if(money<work){money=work;}
	  }
	 }
	 
	 cout<<money<<endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int dp[10000];
	for (int i = 0; i < 10000; ++i) {
		dp[i] = 1e9;
	}
	dp[0] = 0;
	for (int i = 0; i <= 5000; ++i) {
		dp[i + 200] = min(dp[i + 200], dp[i] + 380);
		dp[i + 300] = min(dp[i + 300], dp[i] + 550);
		dp[i + 500] = min(dp[i + 500], dp[i] + 850);
		dp[i + 1000] = min(dp[i + 1000], dp[i] + 380 * 4);
		dp[i + 1200] = min(dp[i + 1200], dp[i] + 1870);
		dp[i + 1500] = min(dp[i + 1500], dp[i] + 2244);
	}
	for (int i = 9998; i >=0;--i) {
		dp[i] = min(dp[i + 1], dp[i]);
	}
	while (1) {
		int N; cin >> N;
		if (!N)break;
		cout << dp[N] << endl;
	}
	return 0;
}

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

#define min(a, b) b < a ? b : a
#define INF (10000000)

int money[51];

void set(void);

int main(void)
{
    int g;
    
    for (int i = 0; i < 51; i++){
        money[i] = INF;
    }
    
    set();
    while (1){
        scanf("%d", &g);
        if (g == 0) break;
        
        g /= 100;
        printf("%d\n", money[g]);
    }
}

void set(void)
{
    for (int i = 0; i < 26; i++){
        for (int j = 0; j < 18; j++){
            for (int k = 0; k < 11; k++){
                if((i * 2) + (j * 3) + (k * 5) < 51){
                    money[(i * 2) + (j * 3) + (k * 5)] = min(money[(i * 2) + (j * 3) + (k * 5)], (i / 5) * 1520 + (i % 5) * 380 + (j / 4) * 1870 + (j % 4) * 550 + (k / 3) * 2244 + (k % 3) * 850);
                }
            }
        }
    }
    
    
}

C++: #include <iostream>

using namespace std;

int memo[5001];
void init(){
  fill(memo, memo+5001, 1<<20);
  for(int i = 0; i*200 <= 5000 ; i++){
    for(int j = 0; j*300 <= 5000 ; j++){
      if(i*200+j*300 > 5000)break;
      for(int k = 0; k*500 <= 5000 ; k++){
	if(i*200+j*300+k*500 > 5000)break;
	int sum = i*200+j*300+k*500;
	int m = (i/5)*1520+(i%5)*380 + (j/4)*1870+(j%4)*550 + (k/3)*2244 + (k%3)*850;
	memo[sum] = min(memo[sum], m);
      }
    }
  }
}
int main(){
  int n;
  init();
  while(cin >> n, n){
    cout << memo[n] << endl;
  }
  return 0;
}