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 <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define FOR(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
const int MAX = 101;

template<class T, class U>
void convert(T &t, U &u){
    stringstream ss;
    ss << t;
    ss >> u;
}

int dp[51];

int main(){
	int w[]={0, 2, 3, 5, 2*5, 3*4, 5*3};
	int m[]={1<<29, 380, 550, 850, 5*380*0.8, 4*550*0.85, 3*850*0.88};

	fill(dp+1, dp+51, 1<<29);

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

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

	return 0;
}

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

const int N = 50;
const int INF = 1e9;

typedef pair<int, double> P;

int main(){
    int n;
    int dp[N + 1];
    int ps[] = {380, 550, 850};
    int ws[] = {2, 3, 5};
    P ds[] = { make_pair(5, 0.8), make_pair(4, 0.85), make_pair(3, 0.88) };
    
    while(cin >> n, n){
        fill(dp, dp + N + 1, INF);
        dp[0] = 0;
        n /= 100;
        for(int i = 0;i < n - 2;++i){
            for(int j = 0;j < 3 && i + ws[j] <= n;++j){
                dp[i + ws[j]] = min(dp[i + ws[j]], dp[i] + ps[j]);
                int idx = i + (ws[j] * ds[j].first);
                if(idx <= n){
                    dp[idx] = min(dp[idx], (int)(dp[i] + ps[j] * ds[j].second * ds[j].first));
                }
            }
        }
        cout << dp[n] << endl;
    }
    return 0;
}

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

int main(){
  int g;
  int dp[3][100];

  
  for(int i=0;i<100;i++){
    int tmp = i/2;
    if(i>2*tmp)tmp++;
    dp[0][i] = (tmp/5) * 1520 + (tmp%5) * 380;
  }

  for(int i=0;i<100;i++){
    dp[1][i] = dp[0][i];
    for(int j=1;j<=i;j++){
      int tmp = j/3;
      if(j>3*tmp)tmp++;
      dp[1][i] = min(dp[1][i],dp[0][i-j] + (tmp/4) * 1870 + (tmp%4) * 550);
    }
  }

  for(int i=0;i<100;i++){
    dp[2][i] = dp[1][i];
    for(int j=1;j<=i;j++){
      int tmp = j/5;
      if(j>5*tmp)tmp++;
      dp[2][i] = min(dp[2][i],dp[1][i-j] + (tmp/3) * 2244 + (tmp%3) * 850);
    }
  }
  /*
  for(int i=0;i<51;i++){
    cout << i << ":" << dp[2][i] << endl;
  }
  */
  while(1){
    cin >> g;
    if(!g)break;
   
    cout << dp[2][g/100] << endl;
  }
}

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

using namespace std;

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

void compute(void){
  
  for( int i = 0 ; i < 100 ; i++ ) dp[i] = 99999;;
  dp[0] = 0;
  for( int i = 0 ; i < 6 ; i++ ){
    for( int j = 0 ; j + weight[i] < 100 ; j++ ){
	dp[j + weight[i]] = min( dp[j + weight[i]] , dp[j] + value[i] );
      // 値段はvalueの6種類のみだからづいじそのパターンで計算
    }
  }

}

int main(void){

  compute();

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

C++: #include <iostream>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int p[6] = {380,550,850,1520,1870,2244};
int w[6] = {200,300,500,1000,1200,1500};

int dp[5001];
const int INF = 1000000;

int main(void){
    rep(i,5001) dp[i]=1<<30;
    dp[0]=0;
    rep(i,6){
        loop(j,w[i],5001){
            dp[j]=min(dp[j-w[i]]+p[i],dp[j]);
        }
    }
    int W;
    while(cin>>W,W){
        cout<<dp[W]<<endl;
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	
	int n;
	int dp[50][50][50];
	int dfs(int a,int b,int c){
		//cout<<a<<" "<<b<<" "<<c<<endl;
		if(dp[a][b][c]!=1<<20)return dp[a][b][c];
		if(a*200+b*300+c*500>n)return 1<<20;
		
		if(a*200+b*300+c*500==n){
			int ret=0;
			while(a>=5)a-=5,ret+=(380*5)*0.8;
			ret+=a*380;
			
			while(b>=4)b-=4,ret+=(550*4)*0.85;
			ret+=b*550;
			
			while(c>=3)c-=3,ret+=(850*3)*0.88;
			ret+=c*850;
			
			return dp[a][b][c]=ret;
		}
		
		int ret=1<<20;
	ret=min( ret,dfs(a+1,b,c) );
	ret=min( ret,dfs(a,b+1,c) );
	ret=min( ret,dfs(a,b,c+1) );
	
	return dp[a][b][c]=ret;
	}


	int main(){
	while(cin>>n,n){
	for(int i=0;i<50;i++)for(int j=0;j<50;j++)for(int k=0;k<50;k++)dp[i][j][k]=1<<20;
	cout<<dfs(0,0,0)<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; ++i)
#define INF ( 1 << 30 )
int main(){
  int dp[5001];
  int item[] = { 200 , 300 , 500 , 1000 , 1200 , 1500 };
  int price[]= { 380 , 550 , 850 , 1520 , 1870 , 2244 };
  fill_n(dp,5001,INF);
  dp[0] = 0;
  rep(i,6) rep(j,5000 - item[i]){
    dp[j + item[i]] = min ( dp[j + item[i]] , dp[j] + price[i] );
  }
  int n;
  while(cin >> n , n) cout << dp[n] << endl;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	int answers[64];
	int dp[64][8][4][4];
	
	rep(i, 51){
		answers[i] = 1<<29;
		rep(j, 5) rep(k, 4) rep(l, 3){
			int ans = i+j+k+l ? 1<<29 : 0;
			if(2<=i && j)
				ans = min(ans, dp[i-2][j-1][k][l] + 380);
			if(10<=i && !j)
				ans = min(ans, dp[i-9][0][k][l] + 1520);
			if(3<=i && k)
				ans = min(ans, dp[i-3][j][k-1][l] + 550);
			if(12<=i && !k)
				ans = min(ans, dp[i-12][j][0][l] + 1870);
			if(5<=i && l)
				ans = min(ans, dp[i-5][j][k][l-1] + 850);
			if(15<=i && !l)
				ans = min(ans, dp[i-15][j][k][0] + 2244);
			dp[i][j][k][l] = ans;
			answers[i] = min(answers[i], ans);
		}
	}
	
	int weight;
	while(scanf("%d", &weight), weight){
		printf("%d\n", answers[weight/100]);
	}
	
	return 0;
}