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>
#include <algorithm>
using namespace std;

int A(int m) {
	int n = m / 200 + (m % 200 ? 1 : 0);
	int ret = 0;
	ret += (n / 5) * 5 * 380 * 80 / 100;
	ret += n % 5 * 380;
	
	return ret;
}
int B(int m) {
	int n = m / 300 + (m % 300 ? 1 : 0);
	int ret = 0;
	ret += (n / 4) * 4 * 550 * 85 / 100;
	ret += n % 4 * 550;

	return ret;
}
int C(int m) {
	int n = m / 500 + (m % 500 ? 1 : 0);
	int ret = 0;
	ret += (n / 3) * 3 * 850 * 88 / 100;
	ret += n % 3 * 850;

	return ret;
}

int main() {
	int m;
	int table[64];

	for(int i = 0; i < 64; i++) {
		table[i] = A(i * 100);
	}
	for(int i = 63; i >= 0; i--) {
		for(int j = 0; j <= i; j++) {
			table[i] = min(table[i], table[i - j] + B(j * 100));
		}
	}
	for(int i = 63; i >= 0; i--) {
		for(int j = 0; j <= i; j++) {
			table[i] = min(table[i], table[i - j] + C(j * 100));
		}
	}

	while(cin >> m, m) {
		cout << table[m / 100] << endl;
	}

	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++){
    a = ((i+1)/10) * 1520 + ((i+1)%10)/2 * 380;
    b = ((i+2)/12) * 1870 + ((i+2)%12)/3 * 550;
    c = ((i+4)/15) * 2240 + ((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>

using namespace std;

int main() {
    while(1){
      int n;
      cin >> n;
      if(n==0) break;
      int min;
      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);
      if(min>fee) min=fee;
	    }
	  }
	}
      }	
      cout << min <<endl;
     } 
   return 0;
    }

C++: #include <iostream>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

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;
    rep(i,5001) dp[i]=1<<30;
    dp[0]=0;

    rep(i,5001)rep(j,6){
        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;
    }
}

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

int kona, minm;

void search(int k, int a, int b, int c){
  if(k <= 0){
    int am = (a / 5) * 5 * 380 * 0.8 + (a % 5) * 380;
    int bm = (b / 4) * 4 * 550 * 0.85 + (b % 4) * 550;
    int cm = (c / 3) * 3 * 850 * 0.88 + (c % 3) * 850;
    int all = am + bm + cm;
    if(all < minm) minm = all;
    return;
  }

  if(k >= 200) search(k - 200, a + 1, b, c);
  if(k >= 300) search(k - 300, a, b + 1, c);
  if(k >= 500) search(k - 500, a, b, c + 1);
}

int main(void){
  while(cin >> kona && kona != 0){
    minm = 100000000;
    search(kona, 0, 0, 0);
    cout << minm << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int in;
  while(cin>>in,in){
    double mini=1e9;
    rep(i,in/500+1){
      if(in-i*500>=0)rep(j,(in-i*500)/300+1){
	  if(in-i*500-j*300>=0)rep(k,(in-i*500-j*300)/200+1){
	      if(in!=i*500+j*300+k*200)continue;
	      //	      cout<<i<<" "<<j<<" "<<k<<endl;
	      double sum=850*(i%3)+850*(i/3)*3*0.88;
	      sum+=550*(j%4)+550*(j/4)*4*0.85;
	      sum+=380*(k%5)+380*(k/5)*5*0.80;
	      mini=min(mini,sum);
	      //	      cout<<i<<" "<<j<<" "<<k<<" "<<sum<<endl;
	    }
	}
    }
    cout<<(int)mini<<endl;
  }

}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int dp[5050];
int main(){
	memset(dp, 0, sizeof(dp));
	rep(i,5050)dp[i]=INF;
	rep(i,20)rep(j,20)rep(k,20){
		int cost =(i*380)-(i/5*380)+(j*550)-(j/4*330)+(k*850)-(k/3*306);
		int w =i*200+j*300+k*500;
		if(w<=5000){
			dp[w]=min(dp[w],cost);
		}
	}
	int n;
	while(cin>>n,n){
		cout <<dp[n]<<endl;
	}
	return 0;
}

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

#define Kinds 6
#define DP 50
const int cost[Kinds]={380,550,850,(int)(380*5*0.8),(int)(550*4*0.85),(int)(850*3*0.88)};
const int Volume[Kinds]={200,300,500,1000,1200,1500};

unsigned int dp[DP];

int main(){
	int n;
	
	std::fill(dp,dp+DP,10000000);
	dp[0]=0;
	for(int i=0;i<DP;++i)
		for(int l=0;l<Kinds;++l)
			if(i-Volume[l]/100>=0)
				dp[i]=std::min(dp[i],dp[i-Volume[l]/100]+cost[l]);
	while( std::cin>>n, n )
		std::cout<<dp[n/100]<<std::endl;
	
	return 0;
}

C++: 
#include <stdio.h>
#define MIN(a,b) ((a>b)? b:a)
#define INT_MAX (1<<22)

int dp[61];
int data[61];

int search(int remains){
  if(dp[remains]) return data[remains];

  if(remains == 0) return 0;
  if(remains == 1) return INT_MAX;

  int k=INT_MAX;

  if(remains >= 15) k = MIN(k, search(remains-15)+2244);
  if(remains >= 12) k = MIN(k, search(remains-12)+1870);
  if(remains >= 10) k = MIN(k, search(remains-10)+1520);
  if(remains >= 5) k = MIN(k, search(remains-5)+850);
  if(remains >= 3) k = MIN(k, search(remains-3)+550);
  if(remains >= 2) k = MIN(k, search(remains-2)+380);

  dp[remains] = 1;
  return data[remains] = k;
}


int main(){
  int i;
  for(i=0;i<=60;i++) dp[i] = 0, data[i] = 0;

  search(60);
  
  int m = INT_MAX;
  /*for(i=60;i>=0;i--) {
    if(dp[i]) {
      m = data[i] = MIN(data[i], m);
    }else {
      data[i] = m;
    }
  }*/

  int n;
  while(1){
    scanf("%d", &n);
    if(n==0) break;
    printf("%d\n", data[n/100]);
  }
}