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 iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int cost_a (int n) {
  int r = (n % 5) * 380;
  r += (n - (n%5)) * 38 * 8;
  return r;
}

int cost_b (int n) {
  int r = (n % 4) * 550;
  r += (n - (n % 4)) * 55 * 85 / 10;
  return r;
}

int cost_c (int n) {
  int r = (n%3)*850;
  r += (n-(n%3)) * 88 * 85 / 10;
  return r;
}

int main() {
  for (;;) {
    int c; cin >> c;
    if (c == 0) break;
    c /= 100;
    int mc = INF;
    rep (i, 1 + c/2) {
      rep (j, 1 + c/3) {
        rep (k, 1 + c/5) {
          if (2 * i + 3 * j + 5 * k == c) {
            int cc = cost_a(i) + cost_b(j) + cost_c(k);
            mc = min(mc, cc);
          }
        }
      }
    }
    cout << mc << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int in;
  while(cin>>in,in){
    double mini=1e9;
    rep(i,in/500+1){
      if(in-i*500>=0)rep(j,(in-i*500)/300+1){
      if(in-i*500-j*300>=0)rep(k,(in-i*500-j*300)/200+1){
          if(in!=i*500+j*300+k*200)continue;
          //          cout<<i<<" "<<j<<" "<<k<<endl;
          double sum=850*(i%3)+850*(i/3)*3*0.88;
          sum+=550*(j%4)+550*(j/4)*4*0.85;
          sum+=380*(k%5)+380*(k/5)*5*0.80;
          mini=min(mini,sum);
          //          cout<<i<<" "<<j<<" "<<k<<" "<<sum<<endl;
        }
    }
    }
    cout<<(int)mini<<endl;
  }
 
}

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*(100-AP)/100+(a%AN)*AM + (b/BN)*BN*BM*(100-BP)/100+(b%BN)*BM + (c/CN)*CN*CM*(100-CP)/100+(c%CN)*CM;
		if(money==0 || money>work){money=work;}
	  }
	 }
	 
	 cout<<money<<endl;
	}
	return 0;
}

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

const int INF = 1<<30;
int w[6] = {2, 3, 5, 10, 12, 15};
int v[6] = {380, 550, 850, 1520, 1870, 2244};
int dp[51];

int main(){
    int i,j;
    dp[0] = 0;
    for(i = 1; i <= 51; i++) dp[i] = INF;
    for(i = 0; i < 6; i++){
        for(j = w[i]; j <= 50; j++){
            dp[j] = min(dp[j], dp[ j-w[i] ] + v[i]);
        }
    }
    while(cin>>i,i) cout << dp[i/100] << endl;
    return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

int N;

void func(){

	int minimum = BIG_NUM,num_a,num_b,num_c,tmp;

	for(int a = 0; a <= N; a += 200){
		for(int b = 0; b <= N; b += 300){
			if(a+b > N)break;
			for(int c = 0; c <= N; c += 500){
				if(a+b+c > N)break;

				if(a+b+c == N){
					num_a = a/200;
					num_b = b/300;
					num_c = c/500;
					tmp = 380*(num_a%5)+550*(num_b%4)+850*(num_c%3)+304*(num_a - num_a%5)+1870*(num_b-num_b%4)/4+748*(num_c-num_c%3);
					minimum = min(minimum,tmp);
				}
			}
		}
	}
	printf("%d\n",minimum);

}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}