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 <iostream>
#define INF 1000000000

using namespace std;

main(){
  int items[]={200, 300, 500, 1000, 1200, 1500};
  int price[]={380, 550, 850, 1520, 1870, 2244};
  int dp[5001];
  for(int i=0;i<=5000;i++){
    dp[i]=INF;
  }
  dp[0]=0;
  for(int i=0;i<6;i++){
    for(int j=0;j+items[i]<=5000;j++){
      dp[j+items[i]]=min(dp[j+items[i]], dp[j]+price[i]);
    }
  }
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    cout << dp[n] << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<float.h>
using namespace std;
typedef struct{
  double ryou;
  int tanka;
  int warimai;
  double wariritu;
}MISE;
MISE mise[3];
double mokuhyou;
double mem[3][100];
double shop(int now,double ryou,double money);
main(){
 mise[0].ryou=2;
 mise[1].ryou=3;
 mise[2].ryou=5;
 mise[0].tanka=380;
 mise[1].tanka=550;
 mise[2].tanka=850;
 mise[0].warimai=5;
 mise[1].warimai=4;
 mise[2].warimai=3;
 mise[0].wariritu=0.8;
 mise[1].wariritu=0.85;
 mise[2].wariritu=0.88;
 while(1){
   for(int i=0;i<3;i++){
     for(int j=0;j<100;j++){
       mem[i][j]=0.0;
     }
   }
   cin>>mokuhyou;
   if(mokuhyou==0)break;
   cout<<(int)shop(0,0.0,0.0)<<endl;
 }
}
double shop(int now,double ryou,double money){
  if(now==3&&ryou*100==mokuhyou){
    return mem[now][(int)ryou/100]=money;
  }
  else if(now==3){
    return DBL_MAX;
  }
  else if(mem[now][(int)ryou]!=0){
    return mem[now][(int)ryou];
  }
  else{
    double mins=DBL_MAX;
    int a=0;
    double before=0;
    mins=min(mins,shop(now+1,ryou,money+before));
    while(ryou*100<=mokuhyou){
      a++;
      ryou+=mise[now].ryou;
      if(a%mise[now].warimai==0){
	before=a*mise[now].tanka*mise[now].wariritu;
      }
      else{
	int aa=a/mise[now].warimai*mise[now].warimai;
	before=aa*mise[now].tanka*mise[now].wariritu+(a-aa)*mise[now].tanka;
      }
      mins=min(mins,shop(now+1,ryou,money+before));
    }
    return mem[now][(int)ryou]=mins;
  }
  return -1;
}

C++: #include <iostream>

using namespace std;

int p[6] = { 380 , 550 , 850 , 1520 , 1870 , 2244};
int w[6] = { 200 , 300 , 500 , 1000 , 1200 , 1500};

int dp[5001];
const int INF = 1000000;

int main(void){
  int W;
  fill(dp , dp+5001 , INF);
  dp[0] = 0;

  for(int i=0; i<=5000; i++){
    for(int j=0; j<6; j++){
      for(int k=max(0,i-w[j]); k<i; k++){
        dp[i] = min(dp[k] + p[j] , dp[i]);
      }
    }
  }  
  
  while(cin >> W, W){
    cout << dp[W] << endl;
  }
  return 0;
}

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

int main() {
  int n;
  int a[3] = {2, 3, 5};
  int b[3] = {380, 550, 850};
  int c[3] = {5, 4, 3};
  int d[3] = {20, 15, 12};
  int e[3];
  int z[51] = {0};
  int f, g, h, s;

  for (int i=0; i<3; i++) {
    e[i] = b[i] * c[i] * (100 - d[i]) / 100;
  }

  for (int i=0; i<3; i++) {
    for (int j=0; j<=50; j++) {
      if (j && !z[j]) continue;
      int k=1;
      while (1) {
        f = j+k*a[i];
        if (f>50) break;
        g = k / c[i];
        h = k - g*c[i];
        s = z[j] + g*e[i] + h*b[i];
        if (!z[f] || s<z[f]) z[f] = s;
        k++;
      }
    }
  }

  //for (int i=6; i<=50; i++) {
  //  for (int j=i-1; j>=5; j--) {
  //    if (z[j]<=z[i]) break;
  //    z[j] = z[i];
  //  }
  //}

  while (cin >> n && n) {
    cout << z[n/100] << endl;
  }

  return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
double EPS = 1e-10;
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003


int dp[353][353]={0};
int bow[353][353]={0};
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b)))
	return 0;
	return a+b;
}

struct P{
	double x,y;
	P(){}
		P(double x,double y):x(x),y(y){
		}
		P operator + (P p){
			return P(add(x,p.x),add(y,p.y));
		}
		P operator - (P p){
			return P(add(x,-p.x),add(y,-p.y));
		}
		P operator *(double d){
			return P(x*d,y*d);
		}
		double dot(P p){
			return add(x*p.x,y*p.y);
		}
		double det(P p){
			return add(x*p.y,-y*p.x);
		}
};

bool cmp_x(const P& p,const P& q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}

vector<P> convex_hull(P* ps, int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> 	qs(n*2);
	
	rep(i,n){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
			k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
		k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}

int n;
P ps[101];

int main(){
	
	int n;
	while(cin>>n,n!=0){
		ll ans=1000000;
	for(int i=0;i<=50;i++){
		for(int j=0;j<=50;j++){
			for(int k=0;k<=50;k++){
				ll cho=380*((i/5)*5)*0.8+380*(i%5);
				cho+=550*((j/4)*4)*0.85+550*(j%4);
				cho+=850*((k/3)*3)*0.88+850*(k%3);
				if(i*200+j*300+k*500==n)
					ans=min(ans,cho);
			}
		}
	}
		cout<<ans<<endl;
	}

	
}