Go: package main

import "fmt"

func main() {
	maxGram := 5000
	// store := map[int]int{
	// 	1500: 2244, // 500 * 3
	// 	1200: 1870, // 300 * 4
	// 	1000: 1520, // 200 * 5
	// 	500:  850,
	// 	300:  550,
	// 	200:  380,
	// }

	for {
		var gram int
		fmt.Scanf("%d", &gram)

		if gram == 0 {
			return
		}

		var minPrice int

		// (x * 200) + (y * 300) + (z * 500) == gram
		for x := 0; (x * 200) <= maxGram; x++ {
			for y := 0; (y * 300) <= maxGram; y++ {
				for z := 0; (z * 500) <= maxGram; z++ {
					if (x*200)+(y*300)+(z*500) == gram {
						price := 0
						price += (z / 3) * 2244
						price += (z % 3) * 850
						price += (y / 4) * 1870
						price += (y % 4) * 550
						price += (x / 5) * 1520
						price += (x % 5) * 380

						if price < minPrice || minPrice == 0 {
							minPrice = price
						}
					}
				}
			}
		}

		fmt.Println(minPrice)
	}
}

// 1 袋あたりの量			200g	300g	500g
// 1 袋の単価(定価)		380円	550円	850円
// 割引が適用される単位		5袋毎	4袋毎	3袋毎
// 割引率							20%引き	15%引き	12%引き

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int dp[200];
signed main(void) {
  REP(i, 200) dp[i] = INF;
  REP(i, 50) REP(j, 50) REP(k, 50) {
    int tmp = i * 2 + j * 3 + k * 5,
        ret = i / 5 * 5 * 304 + (i % 5) * 380 + j / 4 * 4 * 550 * 0.85 +
              (j % 4) * 550 + k / 3 * 3 * 850 * 0.88 + (k % 3) * 850;
    if(tmp <= 50) {
      dp[tmp] = min(dp[tmp], ret);
    }
  }

  int n;
  while(1) {
    cin >> n;
    if(n == 0) break;
    cout << dp[n/100] << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
const int INT_MAX = 1e+7;

int main(){
	int m[5001];
	for(int i=0 ; i < 5001 ; i++ ){
		m[i] = INT_MAX;
	}
	for(int a=0 ; a < 20 ; a++ ){
		for(int b=0 ; b < 20 ; b++ ){
			for(int c=0 ; c < 20 ; c++ ){
				int cost = (a*380) - (a/5*380) + (b*550) - (b/4*330) + (c*850) - (c/3*306);
				int w = a*200 + b*300 + c*500;
				if( w <= 5000 ){
					m[w] = min( m[w] , cost );
				}
			}
		}
	}
	int n;
	while( cin >> n , n ){
		cout << m[n] << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#define INF (1<<26)
using namespace std;
 
int n,ans;
int checkA(int);
int checkB(int);
int checkC(int);
 
int main(){
  while(cin>>n){
    if(n==0)break;
 
    ans=INF;
 
    for(int i=0;i<100;i++){
      for(int j=0;j<100;j++){
    for(int k=0;k<100;k++){
      //if(i==5&&j==0&&k==0)cout<<checkA(i)<<' '<<checkB(j)<<' '<<checkC(k)<<endl;
      if( i*200+j*300+k*500 == n){
        ans=min(ans,checkA(i)+checkB(j)+checkC(k));
      }
 
    }
      }
    }    
    cout<<ans<<endl;
  }
  return 0;
}
int checkA(int cnt){
 
  int x = cnt - (cnt % 5), y = cnt % 5;
  return x*304 + y*380;
}
 
int checkB(int cnt){
 
  int x = cnt - (cnt % 4), y = cnt % 4;
  x/=4;
  return x*1870 + y*550;
}
 
int checkC(int cnt){
 
  int x = cnt - (cnt % 3), y = cnt % 3;
  return x*748 + y*850;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int frower[7][2] = {{0,0},{2,380},{3,550},{5,850},{10,1520},{12,1870},{15,2244}};
  int dp[51] = {0};
  for(int i=1; i<51; i++){dp[i] = 100000;}
  for(int i=0; i<51; i++){
    for(int j=1; j<7; j++){
      if(frower[j][0]<=i){
	dp[i] = min(dp[i],dp[i-frower[j][0]]+frower[j][1]);
      }
    }
  }
  int n;
  while(cin>>n,n){
    cout <<dp[n/100]<<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-=(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){
		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 <algorithm>
using namespace std;
int m[50];
int main()
{
  int i,j,k,a,b,c,n;
  for(i=1;i<=50;i++){
    if((i%2) != 0) a = 10000;
    else a = ((i+1)/10) * 1520 + ((i+1)%10)/2 * 380;
    if((i%3) !=0) b = 10000;
    else b = ((i+2)/12) * 1870 + ((i+2)%12)/3 * 550;
    if((i%5) !=0) c = 10000;
    else c = ((i+4)/15) * 2244 + ((i+4)%15)/5 * 850;
    n = min(a,min(b,c));
    j = 2; k = i-2;
    while(j <= k){
      if(n > m[j] + m[k]) n = m[j] + m[k];
      j++; k--;
    }
    m[i] = n;
  }
  for(;;){
    cin >> n;
    if(n==0) break;
    cout << m[n/100] << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

const int M = 30;

signed main() {
    int n;
    while(cin >> n, n) {
        int ans = INF;
        rep(i,0,M) rep(j,0,M) rep(k,0,M) {
            if(200*i + 300*j + 500*k != n) continue;
            double temp = 0;
            temp += (i/5*5)*380*0.8 + (i%5)*380;
            temp += (j/4*4)*550*0.85 + (j%4)*550;
            temp += (k/3*3)*850*0.88 + (k%3)*850;
            ans = min(ans, (int)temp);
        }
        cout << ans << endl;
    }    
    return 0;
}