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<string>
using namespace std;

int main(){
    int n;
    while(1){
        int num=0;
        int sum=0;
        int res=99999;;
        cin>>n;
        if(n==0)break;
        for(int a=0; a<5; a++) {
            for(int b=0; b<4; b++){
                for(int c=0; c<3; c++){
                    for(int d=0; d<6; d++){
                        for(int e=0; e<5; e++){
                            for(int f=0; f<4; f++){
                                num=a*200+b*380+c*500+d*1000+e*1200+f*1500;
                                sum=a*380+b*550+c*850+d*1520+e*1870+f*2244;
                                if(num==n&&sum<res){
                                    res=sum;
                                }
                            }
                        }
                    }
                }
            }
        }
        cout<<res<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int soba[][2] = {
	{1200, 1870},
	{1000, 1520},
	{1200, 1870},
	{1000, 1520},
	{500, 850},
	{300, 550},
	{200, 380}
};

int main() {
	int n;
	cin >> n;
	if (n) {
		int ans = 0;
		for (int i = 0; i < 6; i++) {
			ans += n / soba[i][0] * soba[i][1];
			n %= soba[i][0];
		}
		cout << ans << endl;
		main();
	}
	return 0;
}

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
const int INF=1<<28;
	int n;
	int dp[50][50][50];
	int ta[]={380,550,850},wa[]={5,4,3};
	
	int dfs(int a,int b,int c){
		//cout<<a<<" "<<b<<" "<<c<<endl;
		if(a*200+b*300+c*500>n)return dp[a][b][c]=INF;
		
		if(dp[a][b][c]!=INF)return dp[a][b][c];	
		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;
			
			if(n==a*200+b*300+c*500)dp[a][b][c]=ret;
			return dp[a][b][c]=ret;
		}
		
		int ret=INF;
	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]=INF;
	cout<<dfs(0,0,0)<<endl;
	}
	return 0;
}