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++: //32
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    int mc=1<<30;
    for(int a=0;a*200<n+200;a++){
      for(int b=0;a*200+b*300<n+300;b++){
	for(int c=0;a*200+b*300+c*500<n+500;c++){
	  if(a*200+b*300+c*500>=n){
	    int cst=a*380+b*550+c*850-(a/5)*380*20*5/100-(b/4)*550*15*4/100-(c/3)*850*12*3/100;
	    mc=min(cst,mc);
	  }
	}
      }
    }
    cout<<mc<<endl;
  }
  return 0;
}

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

using namespace std;
static const int INF = 1e9;
typedef unsigned long long ull;

int g[] = {2, 3, 5, 10, 12, 15};
int p[] = {380, 550, 850, 1520, 1870, 2244};

void solve()
{
	int dp[51];
	for (int i = 0; i < 51; ++i)
	{
		dp[i] = INF;
	}
	dp[0] = 0;
	for (int i = 0; i < 6; ++i)
	{
		for (int j = 0; j < 51; ++j)
		{
			if (j + g[i] < 51 && dp[j + g[i]] > dp[j] + p[i])
			{
				dp[j + g[i]] = dp[j] + p[i];
			}
		}
	}
	int gram;
	while (cin >> gram, gram)
	{
		cout << dp[gram / 100] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int dp[5010];
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	int a[3] = { 200,300,500 },
		b[3] = { 380,550,850 },
		c[3] = { 5,4,3 };
	double d[3] = { 0.8,0.85,0.88 };
	rep(h, 0, 3) {
		rep(i, 1, 30) {
			int m = a[h] * i;
			int p = b[h] * (i / c[h])*c[h] * d[h] + b[h] * (i%c[h]);
			rep(j, 0, 5010 - m) {
				dp[j + m] = min(dp[j + m], dp[j] + p);
			}
		}
	}
	for (int n; cin >> n&&n;) {
		cout << dp[n] << endl;
	}
	return 0;
}

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

int main(){
  int n;

  while(cin>>n,n){
    int ans = INT_MAX;
    int aMinus = 5 * 380 * 0.8;
    int bMinus = 4 * 550 * 0.85;
    int cMinus = 3 * 850 * 0.88;

    for(int i=(n+2000)/200;i>=0;i--){
      int aw = i * 200;
      for(int j=(n+2400)/300;j>=0;j--){
        int bw = j * 300;
        for(int k=(n+3000)/500;k>=0;k--){
          int cw = k * 500;
          if(aw+bw+cw < n) continue;

          //cout<<i<<","<<j<<","<<k<<endl;

          int calA = (i % 5) * 380 + (i / 5) * aMinus;
          int calB = (j % 4) * 550 + (j / 4) * bMinus;
          int calC = (k % 3) * 850 + (k / 3) * cMinus;

          ans = min(ans,calA+calB+calC);
        }
      }
    }

    cout<<ans<<endl;
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

int price[51][4];

int main(){
        int N;
        while(cin>>N,N){
                int ans=INT_MAX;
                for (int i = 0; i*500 <= N; i++) {
                        for (int j = 0; i*500+j*300 <= N; j++) {
                                if(!((N-i*500-j*300)%200)){
                                        int k=(N-i*500-j*300)/200;
                                        int ans2=0;
                                        ans2+=(k%5)*380;
                                        ans2+=(k/5)*1520;
                                        ans2+=(j%4)*550;
                                        ans2+=(j/4)*1870;
                                        ans2+=(i%3)*850;
                                        ans2+=(i/3)*2244;
                                        ans=min(ans,ans2);
                                }
                        }
                }
                cout<<ans<<endl;
        }
        return 0;
}

C++: 
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)

// 500 <= n <= 5000, n+=100
int main(){
    int n,a,b;

    while( cin >> n, n ){
        double ret = 999999999;
        for(a=0; 200*a <= n; a++){
            for(b=0; 200*a + 300*b <= n; b++){
                if( (n - (200*a + 300*b)) % 500 != 0 ) continue;
                int c = (n - (200*a + 300*b)) / 500;
                double ac = (380*5*(int)(a/5))*0.80 + 380*(a%5);
                double bc = (550*4*(int)(b/4))*0.85 + 550*(b%4);
                double cc = (850*3*(int)(c/3))*0.88 + 850*(c%3);
                //printf("a=%d, b=%d, c=%d, sum=%d,  n=%d, ac=%10.4lf, bc=%10.4lf, cc=%10.4lf, sum=%lf\n",a,b,c,200*a+300*b+500*c,n,ac,bc,cc,ac+bc+cc);
                ret = min(ret, ac + bc + cc);
            }
        }
        printf("%d\n",(int)(ret));
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main( ){
  while(1){
    int n,sum=0,a,b,c,sa=0,min,a1=0,a2=0,a3=0;
  cin>>n;
  if(n>=1000){
    for(int i=0;i<=5;i++){
      for(int j=0;j<=5;j++){
        for(int q=0;q<=5;q++){
          sa=n-i*1500-j*1200-q*1000;
          if(i==0&&j==0&&q==0)min=sa;
          if(sa>=0&&sa!=100&&sa<min){
            min=sa;
            a1=i;
          a2=j;
          a3=q;
          }
        }
      }
    }
  }
  sum+=850*3*a1*0.88;
  sum+=550*4*a2*0.85;
  sum+=380*5*a3*0.8;
  n-=1500*a1;
  n-=1200*a2;
  n-=1000*a3;
  a=n/500;
  if(n%500==100)a--;
  sum+=850*a;
  n-=a*500;
  c=n/300;
  if(n%300==100)c--;
  sum+=550*c;
  n-=c*300;
  b=n/200;
  if(n%200==100)b--;
  sum+=380*b;
  cout<<sum<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int n;

int main(){
	while(cin>>n){
		if(n==0)return 0;
		int ans=9999;
		for(int i=0;i<25;i++)
		for(int j=0;j<25;j++)
		for(int k=0;k<25;k++){
			int w=200*i+300*j+500*k,v=380*0.8*(i-(i%5))+380*(i%5)+550*0.85*(j-(j%4))+550*(j%4)+850*0.88*(k-(k%3))+850*(k%3);
			if(w>=n)ans=min(ans,v);
		}
		cout<<ans<<endl;
	}
}