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 w[6]={2,3,5,12,10,15};
int m[6];
int main()
{
	m[5]=(int)850*3*0.88; m[4]=(int)380*5*0.8; m[3]=(int)550*4*0.85;
	m[2]=850; m[1]=550; m[0]=380;
	int W;
	while(1)
	{
		cin >> W ; if(!W) break;
		W/=100;
		int dp[1500][51]={0};
		int pnt=0;
		for(int i=0;i<6;i++)
		{
			if(w[i]>W) continue;
			else if(dp[pnt][w[i]]==0 || dp[pnt][w[i]]>m[i]) dp[pnt][w[i]]=m[i];
			for(int k=0;k<(int)W/w[i];k++)
			{
				for(int j=0;j<=W;j++)
				{
					if(dp[pnt][j]>0 && (dp[pnt+1][j]>dp[pnt][j] || dp[pnt+1][j]==0))
						dp[pnt+1][j]=dp[pnt][j];
					if(dp[pnt][j]>0 && j+w[i]<=W && (dp[pnt+1][j+w[i]]>dp[pnt][j]+m[i] || dp[pnt+1][j+w[i]]==0))
						dp[pnt+1][j+w[i]]=dp[pnt][j]+m[i];
				}
				pnt++;
			}
		}
		cout << dp[pnt][W] << endl;
	}
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a;
	while(scanf("%d",&a),a){
		a/=100;
		int ret=99999999;
		for(int i=0;i<=25;i++){
			for(int j=0;j<=16;j++){
				for(int k=0;k<=10;k++){
					if(i*2+j*3+k*5==a){
						int col=0;
						col+=((i/5)*380*4);
						col+=((i%5)*380);
						col+=((j/4)*550*4*17/20);
						col+=((j%4)*550);
						col+=((k/3)*850*3*22/25);
						col+=((k%3)*850);
						ret=min(ret,col);
					}
				}
			}
		}
		printf("%d\n",ret);
	}
}

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

int main(){

	int w, val[50], cnt[6], v;

	map<char, int> fix, dsc, weight;
	
	weight.insert(make_pair('A', 200));
	weight.insert(make_pair('B', 300));
	weight.insert(make_pair('C', 500));
	
	fix.insert(make_pair('A', 380));
	fix.insert(make_pair('B', 550));
	fix.insert(make_pair('C', 850));
	
	dsc.insert(make_pair('A', 1520));
	dsc.insert(make_pair('B', 1870));
	dsc.insert(make_pair('C', 2244));
	
	fill(val, val+50, 9500);
	fill(cnt, cnt+6, 0);

	for(int cnt_fA=0; cnt_fA<=25; cnt_fA++){
		for(int cnt_fB=0; cnt_fB<=16; cnt_fB++){
			for(int cnt_fC=0; cnt_fC<=10; cnt_fC++){
				for(int cnt_dA=0; cnt_dA<=5; cnt_dA++){
					for(int cnt_dB=0; cnt_dB<=4; cnt_dB++){
						for(int cnt_dC=0; cnt_dC<=3; cnt_dC++){
							w = weight['A']*(cnt_fA + 5*cnt_dA) + weight['B']*(cnt_fB + 4*cnt_dB) + weight['C']*(cnt_fC + 3*cnt_dC);
							if(w <= 5000){
								v = fix['A']*cnt_fA + fix['B']*cnt_fB + fix['C']*cnt_fC + dsc['A']*cnt_dA + dsc['B']*cnt_dB + dsc['C']*cnt_dC;
								val[w/100] = min(val[w/100], v);
							}
						}
					}
				}
			}
		}
	}
	
	while(cin >> w){
		if(w == 0) break;
		cout << val[w / 100] << endl;
	}

	return 0;

}

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

int w[]={2,3,5,10,12,15};
int v[]={380,550,850,1520,1870,2244};
 
int dp[50+1];
void solve(){
    for(int i=0;i<51;i++){
        dp[i]=INT_MAX/3;
    }
    dp[0]=0;
    for(int i=0;i<6;i++){
        for(int j=w[i];j<=50;j++){
            dp[j]=min(dp[j],dp[j-w[i]]+v[i]);
        }
    }
}
 
int main(){
    solve();
    int n;
    while(cin>>n){
        if(n==0)break;
        n/=100;
        cout<<dp[n]<<endl;
    }
  return 0;
}

C++: 
#include <stdio.h>
#define min(x,y) ((x<y)?x:y)
int amount[6] = { 2, 3, 5, 10, 12, 15};
int value[6] = { 380, 550, 850, 1520, 1870, 2244};

int dp[7][51];

void calcMinVal(void){
	int c_shop;
	int c_amount;
	int tmp1;
	int tmp2;
	
	for( c_shop = 0; c_shop < 7; c_shop++){
		for( c_amount = 0; c_amount < 51; c_amount++){
		dp[c_shop][c_amount] = 10000000;
		}
	}

	for(c_shop = 0; c_shop < 7; c_shop++){
		dp[c_shop][0] = 0;
	}
	
	for( c_shop = 0; c_shop < 6; c_shop++){
		for( c_amount = 1; c_amount < 51; c_amount++){
			if( c_amount - amount[c_shop] >= 0){
				tmp1 = dp[c_shop][c_amount - amount[c_shop]] + value[c_shop];
				tmp2 = dp[c_shop+1][c_amount - amount[c_shop]] + value[c_shop];
				dp[c_shop+1][c_amount] = min(dp[c_shop][c_amount],min(tmp1,tmp2));				
			}else{
				dp[c_shop+1][c_amount] = dp[c_shop][c_amount];
			}
		}
	}
}

int main(void){
	int input;
	calcMinVal();
	while(1){
		scanf("%d",&input);
		if(input == 0){
			break;
		}
		printf("%d\n",dp[6][input/100]);
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int price,gram,ans,Nowprice,num;
    while(cin>>gram&&gram!=0){
        ans=100000;
        if(gram%200==0){
            num=gram/200;
            ans=(380*(num/5)*5)*0.8+380*(num%5)-30;
          //cout<<ans<<endl;
        }
        if(gram%300==0){
            num=gram/300;
            Nowprice=550*(num/4)*4*0.85+550*(num%4);
            //cout<<550*(num/4)*4*0.15<<" "<<550*(num%4)<<" "<<Nowprice<<endl;
            if(Nowprice<ans)ans=Nowprice;
        }
        if(gram%500==0){
            num=gram/500;
            Nowprice=850*(num/3)*3*0.88+850*(num%3);
          //\  cout<<850*(num/3)*3*0.12<<" "<<850*(num%3)<<" "<<Nowprice<<endl;
            if(Nowprice<ans)ans=Nowprice;
        }
        cout<<ans<<endl;
    }
}

C++: #include <cstdio>

int price;
int weight;

void solve(int a, int b, int c) {
  int w = a*200 + b*300 + c*500;
  int calc_price = 
    ((a/5)*5) * 380 * 0.8 + (a%5)*380
    + ((b/4)*4) * 550 * 0.85 + (b%4)*550
    + ((c/3)*3) * 850 * 0.88 + (c%3)*850;
  
  if (weight == w) {
    if (price >= calc_price) {
      price = calc_price;
    }
    return;
  } else if (weight < w) {
    return;
  } else {
    solve(a+1, b, c);
    solve(a, b+1, c);
    solve(a, b, c+1);
  } 
}

int main() {
  while(scanf("%d", &weight), weight) {
    price = 1000000000;
    solve(0,0,0);

    printf("%d\n", price);
  }
}

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

#define INF 1<<28

int dp[5001];

int cost(int w) {
    if (w <= 0) return 0;
    if (dp[w] != -1) {
        return dp[w];
    }
    vector<int> costs(6);
    costs[0] = cost(w-200) + 380;
    costs[1] = cost(w-300) + 550;
    costs[2] = cost(w-500) + 850;
    costs[3] = cost(w-1000) + 1520;
    costs[4] = cost(w-1200) + 1870;
    costs[5] = cost(w-1500) + 2244;
    int min_cost = *min_element(costs.begin(), costs.end());
    dp[w] = min_cost;
    return min_cost;
}

int main() {
    int w;
    memset(dp, -1, sizeof(dp));
    while (cin >> w, w != 0) {
        cout << cost(w) << endl;
    }
    return 0;
}

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