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>

using namespace std;

int g;

void solve() {
	int A = g / 200, B = g / 300, C = g / 500;
	int ans = (int)1e9;
	
	for (int a = 0; a <= A; a++) {
		for (int b = 0; b <= B; b++) {
			if (200 * a + 300 * b > g) break;
			
			for (int c = 0; c <= C; c++) {
				if (200 * a + 300 * b + 500 * c > g) break;
				
				if (200 * a + 300 * b + 500 * c == g) {
					int unitA = a % 5, discA = a - unitA;
					int unitB = b % 4, discB = b - unitB;
					int unitC = c % 3, discC = c - unitC;
					
					int buyA = (380 * discA) * 80 / 100 + 380 * unitA;
					int buyB = (550 * discB) * 85 / 100 + 550 * unitB;
					int buyC = (850 * discC) * 88 / 100 + 850 * unitC;
					
					ans = min(ans, buyA + buyB + buyC);
				}
			}
		}
	}
	
	cout << ans << endl;
}

int main() {
	while (1) {
		cin >> g; if (g == 0) break;
		solve();
	}
	
	return 0;
}

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

int n,ans;
int checkA(int);
int checkB(int);
int checkC(int);

int main(){
  while(cin>>n){
    if(n==0)break;
    ans=INF;
    for(int i=0;i<100;i++){
      for(int j=0;j<100;j++){
	for(int k=0;k<100;k++){
	  if(i*200+j*300+k*500>=n){
	    
	    ans=min(checkA(i)+checkB(j)+checkC(k),ans);

	  }
	}
      }
    }    
    cout<<ans<<endl;
  }
  return 0;
}
int checkA(int cnt){
  int x = cnt - (cnt % 5), y = cnt % 5;
  return x*380*0.8 + y*380;
}

int checkB(int cnt){
  int x = cnt - (cnt % 4), y = cnt % 4;
  return x*550*0.85+y*550;
}

int checkC(int cnt){
  int x = cnt - (cnt % 3), y = cnt % 3;
  return x*850*0.88+y*850;
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int v, dp[5001];
const int m[] = {200, 300, 500, 1000, 1200, 1500};
const int p[] = {380, 550, 850, 1520, 1870, 2244};
const int INF = 10000000;

/*
  @ツ残ツづィツづ個重ツつウ
*/

int dfs(int w) {
  if (w <= 0) return 0;
  if (dp[w] >= 0) return dp[w];
  int res = INF;
  rep(i,6) {
    res = min(res, dfs(w-m[i]) + p[i]);
  }
  return dp[w] = res;
}

void solve() {
  cout<<dp[v]<<endl;
}

int main (int argc, char const* argv[]) {
  rep(i,5001) dp[i] = INF;
  
  dp[0] = 0;/*
  rep(z,6) for(int i=0;i+m[z]<5001;i++) {
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }*/
  rep(i,5001) rep(z,6) {
    if (i+m[z] >= 5001) continue;
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }

  while (cin>>v, v) {
    solve();
  }
  return 0;
}

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 += (int)(a * 380 * 0.80 + 0.1) + aa * 380;
  ret += (int)(b * 550 * 0.85 + 0.1) + bb * 550;
  ret += (int)(c * 850 * 0.88 + 0.1) + 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>

int opts[6][2] = {{2, 380},   {3, 550},   {5, 850},
                  {10, 1520}, {12, 1870}, {15, 2244}};

int func(int qnt, int index, int subqnt, int subcost) {
    if (qnt == subqnt) return subcost;
    if (index < 0) return -1;
    int i = (qnt - subqnt) / opts[index][0];
    int min_cost = -1;
    while (i >= 0) {
        int res = func(qnt, index - 1, subqnt + opts[index][0] * i,
                       subcost + opts[index][1] * i);
        if (res > 0 && (min_cost > res || min_cost < 0)) min_cost = res;
        i--;
    }
    return min_cost;
}

int main() {
    int n;
    while (std::cin >> n && n > 0) {
        n /= 100;
        std::cout << func(n, 5, 0, 0) << std::endl;
    }
}

C++: #include<iostream>

using namespace std;

int main()
{
	int money[100][5];
	int n,i,j,k;
	int ans[100];
	
	for(i=0;i<100;i++)
		ans[i]=10000000;
	
	for(i=0;i*2<51;i++)
	{
		if(i%5!=0)
			money[i*2][0]=i*380;
		else
			money[i*2][0]=(i*380)*80/100;
	}
	for(i=0;i*3<51;i++)
	{
		if(i%4!=0)
			money[i*3][1]=i*550;
		else
			money[i*3][1]=(i*550)*85/100;
	}
	for(i=0;i*5<51;i++)
	{
		if(i%3!=0)
			money[i*5][2]=i*850;
		else
			money[i*5][2]=(i*850)*88/100;
	}
	
	for(i=0;2*i<51;i++)
	{
		for(j=0;2*i+3*j<51;j++)
		{
			for(k=0;2*i+3*j+5*k<51;k++)
			{
				if(ans[2*i+3*j+5*k]>money[2*i][0]+money[3*j][1]+money[5*k][2])
					ans[2*i+3*j+5*k]=money[2*i][0]+money[3*j][1]+money[5*k][2];
			}
		}
	}
	
	for(;;)
	{
		cin >> n;
		if(n==0)
			break;
		cout << ans[n/100] << endl;
	}
}

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

int main(){
	while(1){
		int n;
		scanf(" %d", &n);
		if(n==0) break;
		
		int ans=20000;
	
		for(int a=0; a*200<=n; ++a){
			int p=a/5;
			int x=380*5*p*4/5 + 380*(a-5*p);
			int wa=a*200;
			
			for(int b=0; wa+b*300<=n; ++b){
				int q=b/4;
				int y=550*4*q*17/20 + 550*(b-4*q);
				int wb=b*300;
				
				//????????§C???????????????????????°????±???????
				int wc=n-wa-wb;
				if(wc%500!=0) continue;
				else{
					int c=wc/500;
					int r=c/3;
					int z=850*3*r*22/25 + 850*(c-3*r);
					
					if(x+y+z < ans) ans=x+y+z;
				}
				
			}
		}
		
		printf("%d\n", ans);
	}
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int dp[55];
    fill(dp, dp + 55, 1e9);
    dp[0] = 0;
    for(int i = 2; i <= 50; i++){
        dp[i] = dp[i - 2] + 380;
        if(i >= 3) dp[i] = min(dp[i], dp[i - 3] + 550);
        if(i >= 5) dp[i] = min(dp[i], dp[i - 5] + 850);
        if(i >= 10) dp[i] = min(dp[i], dp[i - 10] + 1520);
        if(i >= 12) dp[i] = min(dp[i], dp[i - 12] + 1870);
        if(i >= 15) dp[i] = min(dp[i], dp[i - 15] + 2244);
    }

    int n;
    while(cin >> n){
        if(n == 0) break;
        cout << dp[n / 100] << endl;
    }


    return 0;
}