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;
int main() {
	int n;
	while(cin>>n,n){
		n/=100;
		int num[]={1000000,1000000,1000000};
		if(n%2==0)num[0]=380*(n/10)*5*0.8+n%10/2*380;
		if(n%3==0)num[1]=550*(n/12)*4*0.85+n%12/3*550;
		if(n%5==0)num[2]=850*(n/15)*3*0.88+n%15/5*850;
		cout<<min(min(num[0],num[1]),num[2])<<endl;
	}
}

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

#define INF 10000000

int A(int m) {
	int n = m / 200;
	int ret = 0;

	if(m % 200)
		return INF;
	ret += (n / 5) * 5 * 380 * 80 / 100;
	ret += n % 5 * 380;
	
	return ret;
}
int B(int m) {
	int n = m / 300;
	int ret = 0;

	if(m % 300)
		return INF;
	ret += (n / 4) * 4 * 550 * 85 / 100;
	ret += n % 4 * 550;

	return ret;
}
int C(int m) {
	int n = m / 500;
	int ret = 0;

	if(m % 500)
		return INF;
	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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int d[6] = {1500,1200,1000,500,300,200};
int m[6] = {2244,1870,1520,850,550,380};
int s(int i,int n){
  if(i==5){
    if(n%200) return 1e8;
    else return n/d[i]*m[i];
  }
  return min( n/d[i]*m[i]+s(i+1,n%d[i]), s(i+1,n));
}
int main(void){
  int n;
  while(cin>>n){
    if(!n) break;
    cout<<s(0,n)<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    while (1) {
        int ans = 1000000;
        cin >> n;
        if (n == 0) break;
        for (int a = 0; a <= 50; a++) {
            for (int b = 0; b <= 50; b++) {
                for (int c = 0; c <= 50; c++) {
                    int sum = (380 * (5 * (a / 5))) * 0.8 + (a % 5) * 380;
                    sum += (550 * (4 * (b / 4))) * 0.85 + (b % 4) * 550;
                    sum += (850 * (3 * (c / 3))) * 0.88 + (c % 3) * 850;
                    if (a * 200 + b * 300 + c * 500 == n) {
                        ans = min(ans, sum);
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

struct soba{
	int gram;
	int yen;
	soba(int g, int y){gram=g;yen=y;}
};

int n;
int min_y;
vector<soba> v;


void buy(int sum_g, int sum_y){
	int len = v.size();
	for(int i=0;i < len;i++){
		if(sum_g == n){
			min_y = min(min_y, sum_y);
			return;
		}else if(sum_g > n){
			break;
		}
		buy(sum_g+v[i].gram, sum_y+v[i].yen);
	}
	return;
}


int main(){
	int sum_g, sum_y;
	v.push_back(soba(200,380));
	v.push_back(soba(200*5, (380*5) * 0.8));
	v.push_back(soba(300,550));
	v.push_back(soba(300*4, (550*4) * 0.85));
	v.push_back(soba(500,850));
	v.push_back(soba(500*3, (850*3) * 0.88));
	while(true){
		cin>>n; if(n==0) break;
		min_y = INT_MAX;
		buy(0,0);
		cout<<min_y<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main(){
	int d[60],x;
	rep(i,0,60)d[i]=9999;
	rep(i,0,30)d[i*2]=380*i-380*(i/5);
	rep(i,0,55){
		rep(j,0,(55-i)/3){
			d[j*3+i]=min(d[j*3+i],d[i]+j*550-330*(j/4));
		}
	}
	rep(i,0,55){
		rep(j,0,(55-i)/5){
			d[j*5+i]=min(d[j*5+i],d[i]+j*850-306*(j/3));
		}
	}
	while(cin>>x&&x){
		cout<<d[x/100]<<endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
int a[100],b[100],c[100];

int main(){
	for (int i = 1; i < 100; i++)
		a[i] = b[i] = c[i] = 10000;
	for (int i = 0; i <= 50; i++){
		if(i%2==0)
			a[i] = (i/10) * (380 * 5 * 4 / 5) + 380 * ((i%10)/ 2);
		if(i%3==0)
			b[i] = (i/12) * (550 * 4 * 85/ 100) + 550 * ((i%12)/3);
		if(i%5==0)
			c[i] = (i/15) * (850 * 3 * 88/ 100) + 850 * ((i%15)/5);
	}
	int n;
	while(cin>>n,n){
		n /= 100;
		int ans = (int)1e8;
		for (int i = 0; i <= n; i++){
			for (int j = 0; j <= n-i; j++){
				ans = min(ans,a[i]+b[j]+c[n-i-j]);
			}
		}
		cout << ans << endl;
	}

    return 0;
}

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

const int INF = 1 << 30;
int ans[51];

int main() {
    fill_n(ans, 51, INF);
    for (int a = 0; a < 26; a++) {
        for (int b = 0; b < 19; b++) {
            for (int c = 0; c < 11; c++) {
                int idx = 2 * a + 3 * b + 5 * c;
                if (idx > 50) {
                    continue;
                }
                int a1 = a / 5, a2 = a % 5;
                int b1 = b / 4, b2 = b % 4;
                int c1 = c / 3, c2 = c % 3;
                ans[idx] = min(ans[idx], 1520*a1 + 380*a2 + 1870*b1 + 550*b2 + 2244*c1 + 850*c2);
            }
        }
    }
    int n;
    while (cin >> n, n) {
        cout << ans[n/100] << endl;
    }
}

C++: #include<iostream>

using namespace std;

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