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
}

Python: def solve2(amount):
    """
    ???????¨???????????????¨?????????????????§???
    """
    packages = [(0, 0), (2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)] # 1?¢??????????(100g??????)??¨??????????????¢l
    # dp??¨???2?¬??????????????¨?????????????(100g??????)?????????????????¨??§??????packages????¨????
    # 999999...??????INF??¨?????? (phthon 3.5??\??????????????????math.inf????????¨??§??????)
    cart = [[99999999] * (amount//100 + 1) for _ in range(len(packages))]
    for i in range(len(packages)):
        cart[i][0] = 0          #  0g???????????\????????´??????0???????????????

    for i in range(1, len(packages)):
        for j in range(1, len(cart[0])):
            w = packages[i][0]  #  ??????
            p = packages[i][1]  #  ??????
            # ???????????????????????????????????????????????????????????????????????????????¨????
            cart[i][j] = min(cart[i-1][j], cart[i-1][max(0, j-w)]+p, cart[i][max(0, j-w)]+p)
    return cart[-1][-1]


def main(args):
    while True:
        amount = int(input())
        if amount == 0:
            break
        result = solve2(amount)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int IINF = INT_MAX;

int main() {
    int dp[55];
    fill(dp,dp+55,IINF/2);
    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, n){
        cout << dp[n/100] << endl;
    }
    return 0;
}

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

int w;
int dp[15];
int ans;
const int g[3] = {2, 3, 5};
const int v[3] = {380, 550, 850};
const int n[3] = {5, 4, 3};
const double t[3] = {0.8, 0.85, 0.88};
void rec1(int p, int value, int weight) {
  bool flag = true;
  for(int i = p; i < 3; ++i) {
    if(weight + g[i]*n[i] <= w) {
      flag = false;
      rec1(i, value + (int)(v[i]*n[i]*t[i]+0.5), weight + g[i]*n[i]);
    }
  }
  if(flag) {
    ans = min(ans, value + dp[w - weight]);
  }
}

void solve() {
  w /= 100;
  ans = 99999999;
  rec1(0, 0, 0);
  cout << ans << endl;
}

void make() {
  dp[0] = 0;
  for(int i = 1; i <= 14; ++i) {
    dp[i] = 99999999;
    for(int j = 0; j < 3; ++j) {
      if(i-g[j] >= 0) dp[i] = min(dp[i], v[j] + dp[i-g[j]]);
    }
  }
}

main() {
  make();
  while((cin >> w) && w) solve();
}

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 + 1][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<cstring>

unsigned int dp[51];

const int a[3]={2,3,5},b[3]={380,550,850},c[3]={5,4,3};
const double d[3]={0.8,0.85,0.88};

int main(){
	memset(dp,-1,sizeof(dp));
	
	dp[0]=0;

	for(int k=0;k<51;k++){
		if(dp[k]!=-1){
			for(int i=0;i<3;i++){
				for(int j=0;j<51/a[i];j++){
					int cost=b[i]*j;
					if(j%c[i]==0)cost*=d[i];

					dp[k+a[i]*j]=std::min(dp[k+a[i]*j],dp[k]+cost);
				}
			}
		}
	}
	
	int n;
	while(std::cin>>n,n){
		std::cout<<dp[n/100]<<std::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 a=0;a<=n/200+1;a++){
	for(int b=0;b<=n/300+1;b++){
	  for(int c=0;c<=n/500+1;c++){
	    if(a*200+b*300+c*500==n){
	      fee=a*380+b*550+c*850;
	    if(a>=5) fee+=((a/5)*5*380)*0.8-(a/5*5*380);
	  if(b>=4) fee+=((b/4)*4*550)*0.85-(b/4*4*550);
	if(c>=3) fee+=((c/3)*3*850)*0.88-(c/3*3*850);
	//cout <<a<<"*"<<b<<"*"<<c<<"="<<fee<<endl;
      if(min>fee) min=fee;
	    }
	  }
	}
      }	
      cout << min <<endl;
     } 
   return 0;
    }

C++: #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <vector>

using namespace std;

int s=99999999;

void kakerukamosirenai(int total,int left,int a,int b,int c){
	if(left>0){
		kakerukamosirenai(total+380,left-200,a+200,b,c);//a
		kakerukamosirenai(total+550,left-300,a,b+300,c);//b
		kakerukamosirenai(total+850,left-500,a,b,c+500);//c
	}else if(left==0){
		int cnt=0;
		while(a>=1000){
			a-=1000;
//			total -= 380;
			cnt++;
		}
		total-=(float)(1900*cnt)*0.2;
		cnt=0;

		while(b>=1200){
			b-=1200;
//			total -= 330;
			cnt++;
		}
		total-=(float)(2200*cnt)*0.15;
		cnt=0;

		while(c>=1500){
			c-=1500;
//			total -= 306;
			cnt++;
		}
		total-=(float)(2550*cnt)*0.12;

		if(s>total){
			s = total;
		}
	}else{
//		cout << "erratta" <<endl;
	}
}

int main(){

	vector<int> p;
	int n,c=0,a,t;

	while(1){
		c++;
		cin >> n;
		p.push_back(n);
		if(p[c]==0)break;
	}

	for(int i=0;i<c-1;i++){
		kakerukamosirenai(0,p[i],0,0,0);
		cout << s << endl;
		s = 999999999;
	}

	return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>
const int N = 5100;
const int INF = (1 << 30);

int main() {
  vector<int> v(N, INF);
  v[0] = 0;
  for(int i = 0; i < N; i += 100){
    if(v[i] == INF) continue;
    if(i + 200 < N) v[i + 200] = min(v[i + 200], v[i] + 380);
    if(i + 300 < N) v[i + 300] = min(v[i + 300], v[i] + 550);
    if(i + 500 < N) v[i + 500] = min(v[i + 500], v[i] + 850);
    if(i + 1000 < N) v[i + 1000] = min(v[i + 1000], v[i] + 1520);
    if(i + 1200 < N) v[i + 1200] = min(v[i + 1200], v[i] + 1870);
    if(i + 1500 < N) v[i + 1500] = min(v[i + 1500], v[i] + 2244);
  }
  int n;
  while(cin >>n && n) cout <<v[n] <<endl;
}