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>
#include <algorithm>
using namespace std;

class State{
  static int value[3];
  static int need[3];
  static double r[3];
public:
  int m[3];
  State() {
    fill(m, m+3, 9999);
  }

  int sumCost() {
    double ans = 0;
    for(int i = 0; i < 3; i++) {
      int normal = m[i] % need[i];
      int waribiki = m[i] - normal;
      ans += waribiki*value[i]*r[i] + normal*value[i];
    }
    return (int)ans;
  }
};
int State::value[3] = {380, 550, 850};
int State::need[3] = {5, 4, 3};
double State::r[3] = {0.8, 0.85, 0.88};

main() {
  static int w[3] = {2, 3, 5};
  while(1) {
    int m;
    cin >> m;
    if(m == 0) break;
    m /= 100;
    State dp[m+1];
    for(int i = 0; i < 3 ; i++) {
      for(int j = w[i]; j <= m; j++) {
	State tmp = dp[j-w[i]];
	if(tmp.m[i] == 9999) {
	  for(int k = 0; k < 3; k++) tmp.m[k] = 0;
	}
	tmp.m[i]++;
	int wsum = 0;
	for(int k = 0; k < 3; k++) {
	  wsum += tmp.m[k] * w[k];
	}
	if(wsum != j) continue;
	if(i == 0 || tmp.sumCost() < dp[j].sumCost()) {
	  dp[j] = tmp;
	}
      }
    }
    cout << dp[m].sumCost() << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>

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

using namespace std;


int main()
{
	int dp[5001] = {0};
	
	
	rep(i,5001) dp[i] = 1000000;
	
	int p[6] = {200,300,500,1000,1200,1500};
	int v[6] = {380,550,850,380*5*0.8,550*4*0.85,850*3*0.88};

	dp[0] = 0;
	
	rep(i,6)
	{
		rep(j,5001)
		{
			int x = p[i] + j;
			if(x > 5001) break;

			dp[x] = min(dp[x],dp[j]+v[i]);
		}
	}
	

	int n;
	while(cin >> n && n)
	{
		cout << dp[n] << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int w;
  while (cin >> w, w) {
    int ans = 1 << 30;
    for (int i = 0; i * 200 <= w; i++) {
      for (int j = 0; j * 300 <= w; j++) {
        for (int k = 0; k * 500 <= w; k++) {
          if (i * 200 + j * 300 + k * 500 != w) continue;
          int sub = i * 380 + j * 550 + k * 850;
          sub -= (i / 5) * 5 * 380 * 20 / 100;
          sub -= (j / 4) * 4 * 550 * 15 / 100;
          sub -= (k / 3) * 3 * 850 * 12 / 100;
          ans = min(ans, sub);
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}

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

struct SobaDisc {
  int gram;   //< ???
  int price;  //< ??????
};

vector<int> memo(5000+1, 1 << 20);

SobaDisc ShopInfo[6]{
  { 200, 380 },
  { 300, 550 },
  { 500, 850 },
  { 1000,1520 },
  { 1200,1870 },
  { 1500,2244 },
};

inline int min(int a, int b) { return a < b ? a : b; }

// ?????\??????????????????
void MinMoney() {
  for (int i = 0; i < 6; i++) {
    int gram  = ShopInfo[i].gram;
    int price = ShopInfo[i].price;
    memo[0] = 0;
    for (int j = 0; j + gram <= 5000; j+=100) {
      memo[j + gram] = min(memo[j + gram], memo[j] + price);
    }
  }
}

int main() {
  MinMoney();

  int input_gram;
  while (cin >> input_gram) {
    cout << memo[input_gram] << endl;
  }
}

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

int main(){
	int a[6] = {2, 3, 5, 10, 12, 15}, dp[51], n;
	int b[6] = {380, 550, 850, 1520, 1870, 2244};
	fill(dp, dp+51, INF);
	dp[0] = 0;
	
	for(int i =  0;i <= 50;i++)
		for(int j = 0;j < 6;j++)
			if(i >= a[j])dp[i] = min(dp[i], dp[i-a[j]] + b[j]);
	while(cin >> n, n)cout << dp[n/100] << endl;
	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=1; i<51; i++){
    for(int j=0; j<7; j++){
      dp[i][j] = 100000;
    }
  }
  for(int i=0; i<51; i++){
    for(int j=1; j<7; j++){
      for(int k=0;i+k*frower[j][0]<51;k++){
	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>
#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<50;i++){
      for(int j=0;j<50;j++){
	for(int k=0;k<50;k++){

	  if(i*200+j*300+k*500>=n){
	    ans=min(ans,checkA(i)+checkB(j)+checkC(k));
	  }

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

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

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

C++: // 0-1 knapsack
#include<iostream>
#include<cstring>
using namespace std;

const int INF = (1<<21);

int main(){
    int w[7] = {0, 2, 3, 5, 10, 12, 15};
    int c[7] = {0, 380, 500, 850, 1520, 1870, 2244};

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

    for(int i = 1; i < 7; i++){
        for(int j = 1; j <= 50; j++){
            if(w[i] > j)    dp[i][j] = dp[i-1][j];
            else            dp[i][j] = min(dp[i-1][j], dp[i][j-w[i]]+c[i]); 
        }
    }

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

    return 0;
}

C++: #include<iostream>
#define INF 10000000
using namespace std;
int main(){
	int m[]={380,550,850,1520,1870,2244},dp[100010],
	w[]={2,3,5,10,12,15};
	for(int i=0;i<=100000;i++)
		dp[i]=INF;
	dp[0]=0;
	for(int i=0;i<6;i++)
	for(int j=w[i];j<=100000;j++){
		//if(dp[j-w[i]]==INF)
		//dp[j]=min(m[i],dp[j]);
		//else
		dp[j]=min(dp[j],dp[j-w[i]]+m[i]);
		if(j==22)
		//cout<<i<<' '<<dp[j]<<endl;
	}
	//for(int i=0;i<=2500;i++)
	//cout<<' '<<dp[i]<<endl;
	int n;
	while(cin>>n,n){
		n/=100;
		int ans=INF;
		for(int i=n;i<=n+16;i++){
			if(dp[i]!=INF)
			ans=min(ans,dp[i]);
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
void solve(int w, int sti, int counts[], int *ans){
	if( w < 0 ) return ;
	if( w == 0 ){
		int value = 0;
		const int dv[] = {380,550,850};
		const double ar[] = {0.80, 0.85, 0.88};
		for(int i = 0; i < sizeof(dv)/sizeof(*dv); i++){
			value += (counts[i]%(5-i)) * dv[i];
			value += (int)ceil(dv[i] * ( counts[i] - (counts[i]%(5-i)) ) * ar[i]);
		}
		*ans = min(*ans, value);
	}else{
		int dw[] = {200,300,500};
		for(int i = sti; i < sizeof(dw)/sizeof(dw[0]); i++){
			w -= dw[i];
			counts[i]++;
			solve(w, i, counts, ans);
			counts[i]--;
			w += dw[i];
		}
	}
}
int main(void){
	while(true){
		int w, ans = 10000, cnts[3]={0,};

		cin>>w;
		if(w==0)break;

		solve(w, 0, cnts, &ans);
		cout << ans << '\n';
	}
	return 0;
}