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 <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


int calc( int n, int value, int k, double p ) {
    return (int)( n / k * k ) * value * p + ( n % k ) * value;
}

int solve( int n ) {
    int res = INT_MAX;
    int W[3] = { 200, 300, 500 };
    int V[3] = { 380, 550, 850 };
    int K[3] = { 5, 4, 3 };
    double P[3] = { 0.8, 0.85, 0.88 };
    for ( int a = 0; a < 100; ++ a ) {
        for ( int b = 0; b < 100; ++ b ) {
            for ( int c = 0; c < 100; ++ c ) {
                int sumW = W[0] * a + W[1] * b + W[2] * c;
                if ( sumW != n ) continue;
                res = min( res,
                           calc( a, V[0], K[0], P[0] )
                           + calc( b, V[1], K[1], P[1] )
                           + calc( c, V[2], K[2], P[2] ));
            }
        }
    }
    return res;
}

int main() {
    int n;
    while ( cin >> n && n ) {
        cout << solve( n ) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	int weight[]={2,3,5,10,12,15};
	int price[]={380,550,850,1520,1870,2244};
	
	vi dp(51,1<<29);
	rep(i,6)
		dp[weight[i]]=price[i];
	rep(i,6)
		repi(j,weight[i],51)
			dp[j]=min(dp[j],dp[j-weight[i]]+price[i]);
	
	for(int n;cin>>n,n;)
		cout<<dp[n/100]<<endl;
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <cctype>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;

#define MAXVALUE 1 << 21

vector<int> dp(5001, MAXVALUE);

int init(){
    int item[6] = {200, 300, 500, 1000, 1200, 1500};
    int price[6] = {380, 550, 850, 1520, 1870, 2244};
    dp[0] = 0;
    for (int k = 0; k < 6; k++){
	for (int i = 0; i + item[k] <= 5000; i++){
	    dp[i+item[k]] = min(dp[i+item[k]], dp[i] + price[k]);
	}
    }
}

int main(){
    init();
    int n, mi;
    while (cin >> n && n){
	mi = dp[n];
	cout << mi << endl;
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
//A : 190   : 152
//B : 183.3 : 
//C : 170   :
int main(){
    int n;
    while(cin >> n){
        if( !n ) break;
        int ans = 1001001001, temp;

        for(int a=0;a<=n;a+=200){
            for(int b=0;b<=n;b+=300){
                for(int c=0;c<=n;c+=500){
                    if(a+b+c == n){
                        int na = a/200, nb = b/300, nc = c/500;
                        int nna = na/5, nnb = nb/4, nnc = nc/3;
                        int as = nna*380*5*80/100 + (na%5)*380;
                        int bs = nnb*550*4*85/100 + (nb%4)*550;
                        int cs = nnc*850*3*88/100 + (nc%3)*850;
                        temp = as + bs + cs; 
                        ans = min(ans,temp);
                    }
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


int m[] = {200, 300, 500};
int p[] = {380, 550, 850};
int d[] = {5, 4, 3};
double r[] = {0.8, 0.85, 0.88};
const int INF = 1 << 30;

int dfs(int k, int rest)
{
    if(rest == 0) return 0;
    
    if(k == 3) return INF;
    
    int res = INF;
    for(int i = 0; i * m[k] <= rest; i++)
        chmin(res, dfs(k + 1, rest - m[k] * i) + p[k] * (i - i % d[k]) * r[k] + p[k] * (i % d[k]));
    
    return res;
}

int main()
{
	int v;
	while(cin >> v && v)
        cout << dfs(0, v) << endl;
}

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-=(1900*cnt)*20/100;
		cnt=0;

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

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

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

int main(){

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

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

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

	return 0;
}