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;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const int EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int dp[5012];
	Pii data[3];
	data[0] = Pii(200,380);
	data[1] = Pii(300,550);
	data[2] = Pii(500,850);

	Pii s[3];
	s[0] = Pii(5,20);
	s[1] = Pii(4,15);
	s[2] = Pii(3,12);

	fill(dp,dp+5012,INF);
	
	dp[0] = 0;

	rep(i,3){
		int sum = 0;
		int cnt = 1;
		for(int j = data[i].fi; j < 5012; j += data[i].fi){
			int tmp = 0;
			sum += data[i].se;
			if(cnt%s[i].fi == 0){
				tmp = sum * (100-s[i].se) / 100;
			}
			else tmp = sum;
			dp[j] = min(dp[j],tmp);
			cnt++;
		}
	}
	int dp2[5012];
	fill(dp2,dp2+5012,INF);
	dp2[0] = 0;

	for(int i = 0; i < 5012; i+=100){
		for(int j = 0; j < 5012; j+=100){
			if(i+j < 5012 && dp2[i] != INF && dp[j] != INF)dp2[i+j] = min(dp2[i+j],dp2[i]+dp[j]);
		}
	}

	int N;
	while(scanf("%d",&N),N){
		printf("%d\n",dp2[N]);
	}
	return 0;
}

C++: #include <stdio.h>

int main() {
  int n;
  while (1) {    
    int ans = 1000000;
    scanf("%d", &n);
    if(n==0)break;
    for (int a = 0; a <= 50; a++) {
      for (int b = 0; b <= 50; b++) {
        for (int c = 0; c <= 50; c++) {
          int sum = (380 * a * 0.8) + (a % 5) * 380;
          sum += (550 * b * 0.85) + (b % 4) * 550;
          sum += (850 * c * 0.88) + (c % 3) * 850;
          if (a * 200 + b * 300 + c * 500 == n) {
            if (sum < ans)
              ans = sum;
          }
        }
      }
    }
    printf("%d\n", ans);
  }
  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 <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	int q[] = { 2, 3, 5 };
	int v[] = { 380, 550, 850 };
	int dq[] = { 5, 4, 3 };
	double dis[] = { 0.2, 0.15, 0.12 };
	int g;
	int vv[3][51];
	for (int i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 51; ++j)
		{
			if (j % q[i] != 0)
			{
				vv[i][j] = 100000000;
				continue;
			}
			int sack = (j+q[i]-1) / q[i];
			int disSack = sack / dq[i] * dq[i];
			vv[i][j] = v[i]*sack - (int)(v[i]*disSack*dis[i]);
		}
	}

	int dp[3+1][51];
	for (int i = 0; i < 4; ++i)
		for (int j = 0; j < 51; ++j)
		dp[i][j] = 1000000;
	dp[0][0] = 0;

	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 51; ++j)
			for (int k = 0; k+j < 51; ++k)
				dp[i+1][j+k] = min(dp[i+1][j+k], dp[i][j] + vv[i][k]);

	while (scanf("%d", &g), g)
		printf("%d\n", dp[3][g/100]);

	return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		int N=in();
		if(!N) break;

		int ans = 1<<30;
		int A=N/200;
		for(int a=0;a<=A;a++){
			int B=(N-200*a)/300;
			for(int b=0;b<=B;b++){
				int R=N-200*a-300*b;
				if(R>=0 && !(R%500)){
					int c=R/500;
					int V = (a/5)*1520+(a%5)*380;
					V += (b/4)*1870+(b%4)*550;
					V += (c/3)*2244+(c%3)*850;
					ans = min(ans,V);
				}
			}
		}
		
		out(ans);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int frower[7][2] = {{0,0},{2,380},{3,550},{5,850},{10,1520},{12,1870},{15,2244}};
  int dp[51][7] = {0};
  for(int i=0; i<51; i++){
    for(int j=1; j<7; j++){
      if(!i){
	for(int k=1;k*frower[j][0]<51;k++){
	  if(!dp[k*frower[j][0]][j]){dp[k*frower[j][0]][j] = frower[j][1]*k;}
	  else{dp[k*frower[j][0]][j] = min(dp[k*frower[j][0]][j],frower[j][1]*k);}
	}
      }
      else{
	if(dp[i][j-1]){
	  for(int k=0;i+k*frower[j][0]<51;k++){
	    if(!dp[i+k*frower[j][0]][j]){dp[i+k*frower[j][0]][j] = dp[i][j-1]+frower[j][1]*k;}
	    else{dp[i+k*frower[j][0]][j] = min(dp[i+k*frower[j][0]][j],dp[i][j-1]+frower[j][1]*k);}
	  }
	}
      }
    }
  }
  int n;
  while(cin>>n,n){
    for(int i=n/100; i<51; i++){
      if(dp[i][6]){cout <<dp[i][6]<<endl;break;}
    }
  }
  return 0;
}

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

int main() {
	int g;
	while (cin >> g, g) {
		int MAX = 10000;
		for (int i = 0;i <= g / 200;i++) {
			for (int j = 0;j <= g / 300;j++) {
				for (int k = 0;k <= g / 500;k++) {
					int h = i * 380 + (j * 550) + (k * 850);
					if (i >= 5) {
						int p = i / 5;
						h -= 380 * (p * 5)*0.2;
					}
					if (j >= 4) {
						int q = j / 4;
						h -= 550 * (q * 4)*0.15;
					}
					if (k >= 3) {
						int r = k / 3;
						h -= 850 * (r * 3)*0.12;
					}
					int a = 200 * i + (300 * j) + (500 * k);
					if (a == g) {
						if (MAX > h) {
							MAX = h;
						}
					}
				}
			}
		}
		cout << MAX << endl;
	}
	return 0;
}