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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

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

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
vector<pair<int, int>> soba;
int dfs(int n){
	int mi = 10000;
	if (n == 0)return 0;
	REP(i,6){
		if (n - soba[i].first == 0 || n - soba[i].first >= 200)
			mi = min(mi, dfs(n - soba[i].first) + soba[i].second);
	}
	return mi;
}
int main() {
	
	soba.push_back(pair<int, int>(200,380));//1.9
	soba.push_back(pair<int, int>(300,550));//18.3
	soba.push_back(pair<int, int>(500,850));//1.7
	soba.push_back(pair<int, int>(1000,1520));//1.52
	soba.push_back(pair<int, int>(1200,1870));//1.55
	soba.push_back(pair<int, int>(1500,2244));//1.496
	int n;
	while (cin >> n, n){
		cout << dfs(n) << endl;;

	}
}

C++: #include<iostream>

using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
struct shop{
  int gram,tanka,tekiyou,tanni;
};
int main(){
  int n;
  int nedan[10000]={};
  for(int i=0;i<10000;i++)
    nedan[i]=1000000000;
  struct shop a[3];
  a[0].gram=200;a[0].tanka=380;a[0].tekiyou=1520;a[0].tanni=1000;
  a[1].gram=300;a[1].tanka=550;a[1].tekiyou=1870;a[1].tanni=1200;
  a[2].gram=500;a[2].tanka=850;a[2].tekiyou=2244;a[2].tanni=1500;
  queue<pair<int,int> >nn;
  for(int i=0;i<3;i++){
    nn.push(make_pair(a[i].gram,a[i].tanka));nn.push(make_pair(a[i].tanni,a[i].tekiyou));
  }
  nedan[200]=380;nedan[300]=550;nedan[500]=850;nedan[1000]=1520;
  nedan[1200]=1870;nedan[1500]=2244;
  while(!nn.empty()){
    pair<int,int>now=nn.front();
    nn.pop();
    if(now.first>5000)
      continue;
    for(int i=0;i<3;i++){
      if(now.first+a[i].gram<=5000)
	nedan[now.first+a[i].gram]=min(nedan[now.first+a[i].gram],nedan[now.first]+a[i].tanka);
      if(now.first+a[i].tanni<=5000)
	nedan[now.first+a[i].tanni]=min(nedan[now.first+a[i].tanni],nedan[now.first]+a[i].tekiyou);
    }
  }
  while(cin>>n,n!=0)
    cout<<nedan[n]<<endl;
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign

int dp[50][50][50];
 
signed main()
{
    rep(i, 50) {
        rep(j, 50) {
            rep(k, 50) {
                dp[i][j][k] = (i / 5) * 1520 + (i % 5) * 380 +
                    (j / 4) * 1870 + (j % 4) * 550 +
                    (k / 3) * 2244 + (k % 3) * 850;
            }
        }
    }
    Int(t);
    while (t) {
        int ans = INF;
        t /= 100;
        for (int i = 0; i * 2 <= t; i++) {
            for (int j = 0; i * 2 + j * 3 <= t; j++) {
                if ((t - (i * 2 + j * 3)) % 5) {
                    continue;
                } else {
                    int k = (t - (i * 2 + j * 3)) / 5;
                    ans = min(ans, dp[i][j][k]);
                }
            }
        }
        cout << ans << endl;
        cin >> t;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#define INF 1<<21;
using namespace std;
main(){
  int mokuhyou;
  int r[4]={0,2,3,5};
  double dp[4][51];
  double nn[4]={0,0.8,0.85,0.88};
  double n[4]={0,380,550,850};
  int rr[4]={0,5,4,3};
  double inf=INF;
  while(1){
    cin>>mokuhyou;
    if(mokuhyou==0)break;
    for(int i=0;i<4;i++){
      for(int j=0;j<=50;j++){
	dp[i][j]=INF;
      }
    }
    for(int i=1;i<4;i++){
      int aa=1;
      for(int j=0;j<=mokuhyou/100;j++){
	dp[i][j]=min(dp[i-1][j],dp[i][j]);
      }
      for(int j=r[i];j<=mokuhyou/100;j+=r[i]){
	double as=(aa/rr[i])*rr[i];
	dp[i][j]=min(dp[i][j],(n[i]*(aa-as))+((n[i]*as)*nn[i]));
	aa++;
      }
      for(int j=r[i];j<=mokuhyou/100;j++){
	int aaa=1;
	for(int k=j;k<=mokuhyou/100;k+=r[i]){
	  double aas=(aaa/rr[i])*rr[i];
	  dp[i][k]=min(dp[i][k],dp[i-1][j-r[i]]+(n[i]*(aaa-aas))+((n[i]*aas)*nn[i]));
	  aaa++;
	}
      }
      /*
      for(int j=0;j<4;j++){
	for(int k=0;k<=mokuhyou/100;k++){
	  if(dp[j][k]==inf){
	    cout<<" -1"<<" ";
	  }
	  else{
	    cout<<dp[j][k]<<" ";
	  }
	}
	cout<<endl;
      }
      cout<<endl;
      */
    }
    cout<<dp[3][mokuhyou/100]<<endl;
  }
}