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>

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<iostream>
#include<climits>
using namespace std;
int main(){
  int n;    
  while(cin >> n,n){
    int ans=INT_MAX;
    for(int i=0;i<=25;i++){
      for(int j=0;j<=17;j++){
	for(int k=0;k<=10;k++){
	  if(i*200+j*300+k*500==n){
	    int temp;
	    temp=i*380+j*550+k*850-(i/5)*5*380*20/100;
	    temp-=(j/4)*4*550*15/100-(k/3)*3*850*12/100;
	    if(ans>temp){
	      ans=temp;
	    }
	  }
	}
      }
    }
    cout << ans << endl;
  }
}

C++: #include<iostream>
#include<cmath>
#include<limits.h>
using namespace std;
int grum[3]={200,300,500};
int val[3]={380,550,850};
double dis[3]={0.8,0.85,0.88};
int dis_c[3]={5,4,3};

int main()
{
	int ans[5001];
	for(int i = 500; i < 5100; i+=100)
	{
		ans[i]=INT_MAX;
		for(int j = 0; j <= 25; ++j)
		{
			for(int k = 0; k <= 17; ++k)
			{
				for(int l = 0; l <= 10 ; ++l)
				{
					if(j*200+k*300+l*500<i)
					{
						continue;
					}
					int tmp=0;
					tmp+=(j-j%5)*380*0.8+j%5*380;
					tmp+=(k-k%4)*550*0.85+k%4*550;
					tmp+=(l-l%3)*850*0.88+l%3*850;
					ans[i]=min(ans[i],tmp);
				}
			}
		}
	}
	int n;
	while(cin>>n,n) 
	{
		cout<<ans[n]<<endl;
	}
  return 0;
}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	while(1) {
		int m;
		cin >> m;
		if(m == 0) break;
		m /= 100;
		int ret = INT_MAX;
		rep(i,m/2+1) {
			rep(j,m/3+1) {
				rep(k,m/5+1) {
					if(i * 2 + j * 3 + k * 5 == m) {
						int sum = 0;
						sum += i * 380 + j * 550 + k * 850;
						sum -= i / 5 * (int) (380 * 5 * 0.2) + j / 4 * (int) (550 * 4 * 0.15)
							+ k / 3 * (int) (850 * 3 * 0.12);
						if(sum < ret) {
							ret = sum;
						}
					}
				}
			}
		}
		cout << ret << endl;
	}
	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int n;
int tani[]={5,4,3};
int value[]={380,550,850};
int wari[]={80,85,82};
int gg[]={200,300,500};

int dfs(vi &buy,int gram){
	if(gram>=n){
		int res=0;
		vi nb(buy);
		if(buy[0]==1&&buy[1]==0&&buy[2]==4){
			int j=1;
		}
		REP(i,3){
			while(buy[i]){
				if(buy[i]>=tani[i]){
					res+=value[i]*tani[i]*wari[i]/100;
					buy[i]-=tani[i];
				}else{
					res+=value[i]*buy[i];
					buy[i]=0;
				}
			}
		}
		return res;
	}
	int res=INT_MAX;
	REP(i,3){
		vi nb(buy);
		nb[i]++;
		res=min(res,dfs(nb,gram+gg[i]));
	}
	return res;
}

int main(){
	while(cin>>n,n){
		vi buy(3);
		cout<<dfs(buy,0)<<endl;
	}

}

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

const int MAXW = 6000;
const int INF = 1<<28;
const int V[6] = {380,550,850,380*5*0.8,550*4*0.85,850*3*0.88};
const int W[6] = {200,300,500,200*5,300*4,500*3};

int dp[MAXW];
int w;

int main() {
  fill(dp, dp+MAXW, INF);
  dp[0] = 0;
  for(int i = 0; i < 6; ++i) {
    for(int j = W[i]; j < MAXW; ++j) {
      dp[j] = min(dp[j], dp[j-W[i]]+V[i]);
    }
  }
  while(cin >> w && w) {
    cout << dp[w] << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int ans[51];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int w[6] = {2, 3, 5, 10, 12, 15};
    int v[6] = {380, 550, 850, 1520, 1870, 2244};
    fill(ans, ans+51, INF);
    rep(a, 25){
        rep(b, 16){
            rep(c, 10){
                rep(d, 5){
                    rep(e, 4){
                        rep(f, 3){
                            int weight = 0;
                            weight += w[0] * a;
                            weight += w[1] * b;
                            weight += w[2] * c;
                            weight += w[3] * d;
                            weight += w[4] * e;
                            weight += w[5] * f;
                            if (weight <= 50) {
                                int sum = 0;
                                sum += v[0] * a;
                                sum += v[1] * b;
                                sum += v[2] * c;
                                sum += v[3] * d;
                                sum += v[4] * e;
                                sum += v[5] * f;
                                ans[weight] = min(ans[weight], sum);
                            }
                        }
                    }
                }
            }
        }
    }
    int weight;
    cin >> weight;
    while (weight != 0) {
        weight /= 100;
        cout << ans[weight] << endl;
        cin >> weight;
    }
    return 0;
}