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

int main() {

  while(1) {

    int n;
    cin >> n;
    if(n == 0) break;

    int min = 1000000;
    int fee;
    for(int i=0;i<=n/200+1;i++) {
      for(int j=0;j<=n/300+1;j++) {
	for(int k=0;k<=n/500+1;k++) {
	  if(i*200+j*300+k*500 == n) {
	    fee = i*380 + j*550 + k*850;
	    if(i>=5) fee += ((i/5)*5*380)*0.8 -(i/5*5*380);
	    if(j >=4)fee += ((j/4)*4*550)*0.85 -(j/4*4 * 550);
	    if(k>=3) fee += ((k/3)*3*850)*0.88 -(k/3*3 * 850);
	    //cout <<i<<"*"<<j<<"*"<<k<<"="<< fee << endl;
	    if(min > fee) min = fee;
	  }
	}
      }
    }

    cout << min << endl;
  }

  return 0;

}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;
int n, ret;
int main() {
    while(true) {
        scanf("%d", &n);
        if(n == 0) break;
        ret = 999999999;
        for(int a = 0; a <= 13; a++) {
            for(int b = 0; b <= 9; b++) {
                for(int c = 0; c <= 5; c++) {
                    int value = a * 200 + b * 300 + c * 500;
                    if(n == value) {
                        ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 + (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850);
                    }
                }
            }
        }
        printf("%d\n", ret);
    }
    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==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<bits/stdc++.h>
using namespace std;
#define inf 8500

int main(){
	vector<int> dp(51,inf);
	int w[] = {2,10,3,12,5,15};
	int v[] = {380,380*5*8/10,550,550*4*85/100,850,850*3*88/100};
	dp[0] = 0;
	for(int i=0;i<6;i++)
		for(int j  =0;j<51-w[i];j++)
			dp[j+w[i]] = min(dp[j+w[i]],dp[j]+v[i]);
	while(1){
	int n;
	cin>>n;
	if(n==0)break;
	cout<<dp[n/100]<<endl;
	}


	return 0;
}

C++: #include <cstdio>

int main(){
	int n, ans;
	while(scanf("%d", &n),n){
		ans = 100000000;
		for(int i = 0; i <= 25; i++){
			for(int j = 0; j <= 20; j++){
				for(int k = 0; k <= 10; k++){
					if(i*200+j*300+k*500==n){
						int tmp;
						tmp = i*380+j*550+k*850-(i/5)*5*380*20/100-(j/4)*4*550*15/100-(k/3)*850*3*12/100;
						printf("%d\n", tmp);
						if(ans > tmp) ans = tmp;
					}
				}
			}
		}
		printf("%d\n", ans);
	}
}

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

using namespace std;

int main() {
    const int INF = 10e+7;

    vector<pair<int,int>> v; // (g, yen)
    v.push_back(make_pair(2, 380));
    v.push_back(make_pair(3, 550));
    v.push_back(make_pair(5, 850));
    v.push_back(make_pair(2*5, 380*5*80/100));
    v.push_back(make_pair(3*4, 550*4*85/100));
    v.push_back(make_pair(5*3, 850*3*88/100));

    int dp[501];
    for (int i=0; i<=500; ++i) dp[i] = INF;
    dp[0] = 0;
    for (int i=0; i<(int)v.size(); ++i) {
        for (int j=0; j<=500; ++j) {
            int k = j + v[i].first;
            if (dp[j] != INF && k <= 500) {
                dp[k] = min(dp[k], dp[j] + v[i].second);
            }
        }
    }

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

    return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int dp[10000];
	for (int i = 0; i < 10000; ++i) {
		dp[i] = 1e9;
	}
	dp[0] = 0;
	for (int i = 0; i <= 50; ++i) {
		for (int j = i + 1; j < 90; ++j) {
			dp[i] = min(dp[i], dp[j]);
		}
		dp[i + 2] = min(dp[i + 2], dp[i] + 380);
		dp[i + 3] = min(dp[i + 3], dp[i] + 550);
		dp[i + 5] = min(dp[i + 5], dp[i] + 850);
		dp[i + 10] = min(dp[i + 10], dp[i] + 380 * 4);
		dp[i + 12] = min(dp[i + 12], dp[i] + 1870);
		dp[i + 15] = min(dp[i + 15], dp[i] + 2244);
	}
	for (int i = 98; i >=0;--i) {
		dp[i] = min(dp[i + 1], dp[i]);
	}
	while (1) {
		int N; cin >> N;
		if (!N)break;
		N /= 100;
		cout << dp[N] << endl;
	}
	return 0;
}

C++: #include<stdio.h>

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


int main(void){
	int n;
	while(scanf("%d", &n) && n ){
		int dp[200001] ={0};
		
		for(int i = 1; ; i++){
			for(int j = 0; j < 6; j++){
				if(i-price[j] < 0)break;
				if(dp[i-price[j]]+weight[j] > dp[i]){
					dp[i] = dp[i-price[j]]+weight[j];
				}
			}
			if(dp[i]>=n){
				printf("%d\n",i);
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstring>
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;
const int m[] = {200, 300, 500, 1000, 1200, 1500};
const int p[] = {380, 550, 850, 1520, 1870, 2244};
const int INF = 10000000;

/*
  @ツ残ツづィツづ個重ツつウ
*/
int dp[5001];

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() {
  memset(dp, -1, sizeof dp);
  cout<<dfs(v)<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>v, v) {
    solve();
  }
  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;
  return x*467.5 + y*550;
}

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