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<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)

int main(){
	int n;
	int m[]={2,3,5,10,12,15,};
	int v[]={380,550,850,1520,1870,2244,};
	int dp[5000];
	rep(i,50)dp[i]=99999;
	rep(i,6)dp[m[i]]=v[i];
	rep(i,50){
		rep(j,6){
			int t=dp[i]+v[j];
			dp[i+m[j]]=min(dp[i+m[j]],t);
		}
	}
	for(;;){
		scanf("%d",&n);
		if(n==0)break;
		printf("%d\n",dp[n/100]);
	}
	return 0;
}

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

#define INF 0x33433433

int m;
int ws[] = {15, 12, 10, 5, 3, 2, 1};
int vs[] = {2244, 1870, 1520, 850, 550, 380, 380};
int dp[7][51];

int main() {
  while (1) {
    scanf("%d", &m);
    if (m == 0) return 0;

    for (int i=0; i<7; i++) {
      for (int j=0; j<=50; j++) {
        dp[i][j] = INF;
      }
    }

    dp[0][0] = 0;
    for (int i=0; i<6; i++) {
      for (int j=0; j<=50; j++) dp[i+1][j] = dp[i][j];
      for (int j=0; j<=50-ws[i]; j++) {
        dp[i+1][j+ws[i]] = min(dp[i+1][j]+vs[i], dp[i+1][j+ws[i]]);
      }
    }
    printf("%d\n", dp[6][m/100]);
  }
}

C++: #include <iostream>
#include <algorithm>
 
using namespace std;
 
const int inf = 999999;
 
int main()
{
  int r = inf, w;
 
  for(int i = 0; i <= 25; i++){
    for(int j = 0; j <= 17; j++){
      for(int k = 0; k <= 10; k++){
    w = i*200+j*300+k*500;
    if(n == w){
      r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850);
    } else if(n < w){
      break;
    }
      }
    }
  }

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<map>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXI = 8, MAXJ = 60, INF = (1 << 28) - 1;

int w[] = {2, 3, 5, 10, 12, 15};
int v[] = {380, 550, 850, 380*5 * 8 /10, 550*4*85/100, 850*3*88/100};
int dp[MAXI][MAXJ];

int main()
{
    memset(dp, INF, sizeof(dp));
    rep(j,MAXJ) dp[0][j] = INF;
    rep(i,MAXI) dp[i][0] = 0;


    REP(6)for(int j = 1;j<51;j++)
        dp[i+1][j] = min(dp[i][j], dp[i][j - w[i]] + v[i]);

    int wei;
    while(cin >> wei && wei)cout << dp[6][wei / 100] << endl;

    
    return 0;
}

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;
				minimum_cost = min(minimum_cost, cost);
			}
		}
		cout << minimum_cost << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
 
int main() {
 
  while(1) {
 
    int n;
    cin >> n;
    if(n == 0) break;
 
    int min = 1000000;
    int fee;
    for(int i=0;i<=n/200+1;i++) {
      for(int j=0;j<=n/300+1;j++) {
    for(int k=0;k<=n/500+1;k++) {
      if(i*200+j*300+k*500 == n) {
        fee = i*380 + j*550 + k*850;
        if(i>=5) fee += ((i/5)*5*380)*0.8 -(i/5*5*380);
        if(j >=4)fee += ((j/4)*4*550)*0.85 -(j/4*4 * 550);
        if(k>=3) fee += ((k/3)*3*850)*0.88 -(k/3*3 * 850);
        //cout <<i<<"*"<<j<<"*"<<k<<"="<< fee << endl;
        if(min > fee) min = fee;
      }
    }
      }
    }
 
    cout << min << endl;
  }
 
  return 0;
 
}

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

const int MAX_WEIGHT = 5000;
const int MIN_WEIGHT = 500;

struct Comodity{
	int weight, price, unit;
	double rate;
};

Comodity com_list[] = {
	{ 200, 380, 5, 0.8 },
	{ 300, 550, 4, 0.85 },
	{ 500, 850, 3, 0.88 },
};

enum{
	A,
	B,
	C,
};

int quantity( int remain, int unit_weight ){
	return remain > 0 ? remain / unit_weight + ( remain % unit_weight ? 1 : 0 ) : 0;
}

int calcPrice( int a, int b, int c ){
	int dis_a = a / com_list[ A ].unit * com_list[ A ].unit;
	int dis_b = b / com_list[ B ].unit * com_list[ B ].unit;
	int dis_c = c / com_list[ C ].unit * com_list[ C ].unit;
	a -= dis_a;
	b -= dis_b;
	c -= dis_c;
	return ( a * com_list[ A ].price ) + ( b * com_list[ B ].price ) + ( c * com_list[ C ].price )
		+ (int)( dis_a * com_list[ A ].price * com_list[ A ].rate )
		+ (int)( dis_b * com_list[ B ].price * com_list[ B ].rate )
		+ (int)( dis_c * com_list[ C ].price * com_list[ C ].rate );
}

int main()
{
	int weight;

	while( cin >> weight && weight ){
		int best_price = INT_MAX;
		int remain_a = weight;
		int a = quantity( remain_a, com_list[ A ].weight );
		for( ; a >= 0; --a ){
			int remain_b = remain_a - a * com_list[ A ].weight;
			int b = quantity( remain_b, com_list[ B ].weight );
			for( ; b >= 0; --b ){
				int remain_c = remain_b - b * com_list[ B ].weight;
				int c = quantity( remain_c, com_list[ C ].weight );
				best_price = min( best_price, calcPrice( a, b, c ) );
			}
		}
		cout << best_price << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define mk make_pair
using namespace std;
int sum;
set<pair<pair<int,int>,int> >s;
void dfs(int a,int b,int c,int n){
  if(s.count(mk(mk(a,b),c)))return;
  s.insert(mk(mk(a,b),c));
  if(n==0){
    int aa=0,bb=0,cc=0;
    if(a>=5)aa=a/5*1520;
    if(b>=4)bb=b/4*1870;
    if(c>=3)cc=c/3*2244;
    sum=min(sum,aa+bb+cc+a%5*380+b%4*550+c%3*850);
  }
  else{
    if(n-200>=0)dfs(a+1,b,c,n-200);
    if(n-300>=0)dfs(a,b+1,c,n-300);
    if(n-500>=0)dfs(a,b,c+1,n-500);
  }
}
int main(){
  int a;
  while(cin>>a,a){
    s.clear();
    sum=1e9;
    dfs(0,0,0,a);
    cout<<sum<<endl;
  }
}

C++: #include <iostream>
#include <algorithm>
 
using namespace std;
 
const int inf = 999999;
 
int func(int n;)
{
  
  int r = inf, w;
 
  for(int i = 0; i <= 25; i++){
    for(int j = 0; j <= 17; j++){
      for(int k = 0; k <= 10; k++){
    w = i*200+j*300+k*500;
    if(n == w){
      r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850);
    } else if(n < w){
      break;
    }
      }
    }
  }

C++: #include <stdio.h>
#include <algorithm>
using namespace std;
int n, ret;
int main() {
    while(true) {
        scanf("%d", &n);
        if(n == 0) break;
        ret = 999999999;
        for(int a = 0; a <= 13; a++) {
            for(int b = 0; b <= 9; b++) {
                for(int c = 0; c <= 5; c++) {
                    int value = a * 200 + b * 300 + c * 500;
                    if(n == value) {
                        ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 * (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850;
                    }
                }
            }
        }
        printf("%d\n", ret);
    }
    return 0;
}