Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const qA, qB, qC = 200, 300, 500
const pA, pB, pC = 380, 550, 850
const dA, dB, dC = 5, 4, 3

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		q, _ := strconv.Atoi(stdin.Text())
		if q == 0 {
			break
		}

		// A 0袋から始める
		curPrice, newPrice := 0, 0
		// B
		for a := 0; a <= int(q/qA); a++ {
			for b := 0; b <= int((q-qA*a)/qB); b++ {
				// 残り
				rem := q - qA*a - qB*b
				if rem == 0 || ((rem > 0) && ((rem % qC) == 0)) {
					// ちょうど買える
					newPrice = amount(a, b, int(rem/qC))
					if curPrice == 0 || newPrice < curPrice {
						// println(a, b, int(rem/qC), newPrice)
						curPrice = newPrice
					}
				}
			}
		}
		fmt.Println(curPrice)
	}
}

func amount(a, b, c int) int {
	tA := int(float64(int(a/dA)*dA*pA)*0.8) + (a%dA)*pA
	tB := int(float64(int(b/dB)*dB*pB)*0.85) + (b%dB)*pB
	tC := int(float64(int(c/dC)*dC*pC)*0.88) + (c%dC)*pC
	// println("amount:", a, b, c, tA, tB, tC, tA+tB+tC)
	return tA + tB + tC
}

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

#define INF 1000000000

using namespace std;

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

int main(void){

    int dp[5001];
    int g;

    for(int i = 0; i < 5001; i++){
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 0; i < 5000; i++){
        for(int j = 0; j < 6; j++){
            if(w[j] + i < 5001){
                if(dp[i] + p[j] < dp[i+w[j]]){
                    dp[i+w[j]] = dp[i] + p[j];
                }
            }
        }
    }


    while(scanf("%d", &g) && g != 0){
        printf("%d\n", dp[g]);
    }

    return 0;
}

C++: #include<bits/stdc++.h>
#define mk make_pair
using namespace std;
int sum;
set<pair<pair<int,int>,int> >s;
void dfs(int a,int b,int c,int n){
  if(s.count(mk(mk(a,b),c)))return;
  s.insert(mk(mk(a,b),c));
  if(n==0){
    int aa=0,bb=0,cc=0;
    if(a>=5)aa=a/5*1520;
    if(b>=4)bb=b/4*1870;
    if(c>=3)cc=c/3*2244;
    sum=min(sum,aa+bb+cc+a%5*360+b%4*550+c%3*850);
  }
  else{
    if(n-200>=0)dfs(a+1,b,c,n-200);
    if(n-300>=0)dfs(a,b+1,c,n-300);
    if(n-500>=0)dfs(a,b,c+1,n-500);
  }
}
int main(){
  int a;
  while(cin>>a){
    s.clear();
    sum=1e9;
    dfs(0,0,0,a);
    cout<<sum<<endl;
  }
}

C++: #include<iostream>
#include<vector>
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int wari[3][2] = {
  {500,850},
  {300,550},
  {200,380},
};
int main(void){
  int n;
  while(cin>>n,n){
  
    int money = 1e9;
    n /= 100;
    rep(i,26){
      rep(j,17){
	rep(k,11){
	  if (2 * i + 3 * j + 5 * k == n) { 
	    money = min(money,  
			i / 5 * 1520 + i % 5 * 380 +
			j / 4 * 1870 + j % 4 * 550 +
			k / 3 * 2244 + k % 3 * 850);
	  }
	}
      }
    }
    
    cout<<money<<endl;
  }
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int fr[6][2] = {{2,380},{3,550},{5,850},{10,1520},{12,1870},{15,2244}};
  int dp[51] = {0},n;
  for(int i=1; i<51; i++){dp[i] = 10000;}
  for(int i=0; i<51; i++){
    for(int j=0; j<7; j++){
      if(fr[j][0]<=i){
	dp[i] = min(dp[i],dp[i-fr[j][0]]+fr[j][1]);
      }
    }
  }
  while(cin>>n,n){
    cout <<dp[n/100]<<endl;
  }
  return 0;
}

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

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)

int main()
{
    int qa = 200;
    int qb = 300;
    int qc = 500;
    int pa = 380;
    int pb = 550;
    int pc = 850;
    int ua = 5;
    int ub = 4;
    int uc = 3;
    int ra = 20;
    int rb = 15;
    int rc = 12;

    int n;
    int tmp;
    while (scanf("%d", &n),n)
    {
        int ret = 10000;
        rep(i, n / qa + 1)
            rep(j, n / qb + 1)
                rep(k, n / qc + 1)
                    if (i * qa + j * qb + k * qc == n)
                    {
                        tmp = i * pa + j * pb + k * pc;
                        tmp -= ((i / ua) * ua * pa * ra) / 100;
                        tmp -= ((j / ub) * ub * pb * rb) / 100;
                        tmp -= ((k / uc) * uc * pc * rc) / 100;
                        ret = min(ret, tmp);
                    }
        printf("%d\n", ret);
    }
    return 0;
}

C++: #include <iostream>
#include <deque>

using namespace std;

int main(void){
  int w, tmpw;
  int c;
  int ret;
  deque<pair<int, int> > q;
  
  while(cin >> w && w){
	q.push_back(make_pair(0,0));
	ret = 1<<30;
	while(!q.empty()){
	  tmpw = q.front().first;
	  c = q.front().second;
	  q.pop_front();
	  if(c >= ret){
		continue;
	  }
	  if(tmpw >= w){
		ret = min(ret, c);
		continue;
	  }

	  q.push_back(make_pair(tmpw+1500,c+850*3*0.88)); //@1.49
	  q.push_back(make_pair(tmpw+1000,c+380*5*0.8));  //@1.52
	  q.push_back(make_pair(tmpw+1200,c+550*4*0.85)); //@1.55
	  q.push_back(make_pair(tmpw+500,c+850));         //@1.7
	  q.push_back(make_pair(tmpw+300,c+550));         //@1.83
	  q.push_back(make_pair(tmpw+200,c+380));         //@1.9
	}
	cout << ret << endl;
  }
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int buy_A(int n){
	return 380*(n-n%5)*0.80 + 380 * (n%5);
}

int buy_B(int n){
	return 550*(n-n%4)*0.85 + 550 * (n%4);
}

int buy_C(int n){
	return 850*(n-n%3)*0.88 + 850 * (n%3);
}

int main(){
	int W;
	while(~scanf("%d",&W)){
		if(W==0) break;
		W/=100;
		int res=numeric_limits<int>::max();


		//25,17,10
		for(int a=0; a<=30;a++){
			for(int b=0; b<=30;b++){
				for(int c=0; c<=30;c++){
					if(a*2+b*3+c*5 - W == 0){
						res = min(res,buy_A(a)+buy_B(b)+buy_C(c));
					}

				}
			}

		}

		cout << res << endl;

	}
}

C++: #include <iostream>

using namespace std;

int soba[][2] = {
	{1200, 1870},
	{1000, 1520},
	{1200, 1870},
	{500, 850},
	{300, 550},
	{200, 380}
};

int main() {
	int n;
	cin >> n;
	if (n) {
		int ans = 0;
		for (int i = 0; i < 6; i++) {
			ans += n / soba[i][0] * soba[i][1];
			n %= soba[i][0];
		}
		if (n) {
			ans += soba[5][0];
		}
		cout << ans << endl;
		main();
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int buy_A(int n){
	return 380*(n-n%5)*0.80 + 380 * (n%5);
}

int buy_B(int n){
	return 550*(n-n%4)*0.85 + 550 * (n%4);
}

int buy_C(int n){
	return 850*(n-n%3)*0.88 + 850 * (n%3);
}

int main(){
	int W;
	while(~scanf("%d",&W)){
		if(W==0) break;
		W/=100;
		int res=100000000;

		for(int a=0; a<=25;a++){
			for(int b=0; b<=17;b++){
				for(int c=0; c<=10;c++){
					if(W-a*2-b*3-c*5 <= 0){
						res = min(res,buy_A(a)+buy_B(b)+buy_C(c));
					}

				}
			}

		}

		cout << res << endl;

	}
}