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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int f(int a,int b,int c){
	int res=0;
	res+=a/5*5*380*80/100+a%5*380;
	res+=b/4*4*550*85/100+b%4*550;
	res+=c/3*3*850*88/100+c%3*850;
	return res;
}

int main() {
	int n;
	while(n=in()){
		int res=1000000000;
		int a,b,c;
		for(a=0;a<=n/200+1;a++){
			for(b=0;b<=n/300+1;b++){
				for(c=0;c<=n/500+1;c++){
					if(a*200+b*300+c*500>=n){
						chmin(res,f(a,b,c));
//cout<<a<<" "<<b<<" "<<c<<" "<<f(a,b,c)<<endl;
					}
				}
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

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

using namespace std;

struct data {
	int w, price;

	data() { this -> w = this -> price = 0; }
	data(int w, int price) : w(w), price(price) {}
};

bool operator<(const data &a, const data &b) {
	return a.price > b.price;
}

data operator+(const data &a, const data &b) {
	data ret;

	ret.w = a.w + b.w;
	ret.price = a.price + b.price;

	return ret;
}

int main() {
	vector<data> v;

	v.push_back( data(2, 380) );
	v.push_back( data(3, 550) );
	v.push_back( data(5, 850) );

	v.push_back( data(2*5, 380*5*(100-20)/100) );
	v.push_back( data(3*4, 550*4*(100-15)/100) );
	v.push_back( data(5*3, 850*3*(100-12)/100) );

	int price[51]; fill(&price[0], &price[0]+51, -1);

	priority_queue<data> Q; Q.push( data(0, 0) );
	while ( !Q.empty() ) {
		data d = Q.top(); Q.pop();

		if (d.w > 50 || price[d.w] >= 0) continue;
		price[d.w] = d.price;

		for (int i = 0; i < v.size(); ++i)
			Q.push( d + v[i] );
	}

	int w;
	while (cin >> w, w)
		cout << price[w/100] << endl;
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int v, dp[5001];
const int m[] = {200, 300, 500, 1000, 1200, 1500};
const int p[] = {380, 550, 850, 1520, 1870, 2244};
const int INF = 10000000;

/*
  @ツ残ツづィツづ個重ツつウ
*/

int dfs(int w) {
  if (w <= 0) return 0;
  if (dp[w] >= 0) return dp[w];
  int res = INF;
  rep(i,6) {
    res = min(res, dfs(w-m[i]) + p[i]);
  }
  return dp[w] = res;
}

void solve() {
  cout<<dp[v]<<endl;
}

int main (int argc, char const* argv[]) {
  rep(i,5001) dp[i] = INF;
  
  dp[0] = 0;
  rep(z,6) for(int i=0;i+m[z]<5001;i++) {
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }

  while (cin>>v, v) {
    solve();
  }
  return 0;
}

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

using namespace std;

int main(){

	int quan;
	while(cin>>quan&&quan!=0){
		int minCost=100000000;
		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==quan){
						int il=i%5;
						int jl=j%4;
						int kl=k%3;
						int sum=(i-il)*380*0.8+il*380;
						sum+=(j-jl)*550*0.85+jl*550;
						sum+=(k-kl)*850*0.88+kl*850;
						minCost=min(minCost,sum);
					}
				}
			}
		}
		cout<<minCost<<endl;
	}

	return 0;
}

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*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*467.5 + y*550;
}

int checkC(int cnt){
  int x = cnt - (cnt % 3), y = cnt % 3;
  return x*748 + y*850;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

bool isLeap(int y);
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	int dp[50], g, price, a1, a5, b1, b5, c1, c5, inp;
	
	rep(i, 50) dp[i] = INF;
	
	rep(a, 25) rep(b, 16) rep(c, 10)
	{
		g = 2 * a + 3 * b + 5 * c;
		if (g > 50) continue;
		a1 = a % 5; a5 = a / 5;
		b1 = b % 4; b5 = b / 4;
		c1 = c % 3; c5 = c / 3;
		price = 380*a1 + 1520*a5 + 550*b1 + 1870*b5 + 850*c1 + 2244*c5;
		if (dp[g] > price) dp[g] = price;
	}
	
	while (cin >> inp, inp)
	{
		cout << dp[inp / 100] << endl;
	}
	
	return 0;
}


bool isLeap(int y)
{
	return y % 400 == 0
						? true : y % 100 == 0
						? false : y % 4 == 0
						? true : false;
}

ll gcd(ll a, ll b)
{
	return (b > 0) ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}

void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}