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 <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int priceAtA(int n) {
    int bags = ceil(n / 200.);
    int lp = bags % 5;
    return 380 * lp + (380 * (bags - lp) * 0.8);
}

int priceAtB(int n) {
    int bags = ceil(n / 300.);
    int lp = bags % 4;
    return 550 * lp + (550 * (bags - lp) * 0.85);
}

int priceAtC(int n) {
    int bags = ceil(n / 500.);
    int lp = bags % 3;
    return 850 * lp + (850 * (bags - lp) * 0.88);
}

void solve107(int n) {
    int price = 1e9;
    for (int i = 0; i <= n; i+=100) {
        for (int j = 0; j <= n; j+=100) {
            for (int k = 0; k <= n; k+=100) {
                if (i + j + k == n) {
                    price = min(price, priceAtA(i) + priceAtB(j) + priceAtC(k));
                }
            }
        }
    }
    cout << price << endl;
}

int main() {
    int n;
    while(cin >> n, n) {
        solve107(n);
    }
    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;
						if(ans > tmp) ans = tmp;
					}
				}
			}
		}
		printf("%d\n", ans);
	}
}

C++: #include<iostream>

using namespace std;

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

int main()
{
  for(int i = 0; i < 5001; i++)
    dp[i] = 10000000;
  dp[0] = 0;
  for(int j = 0; j < 6; j++)
  {
    for(int i = 0; i < 5001; i += 100)
    {
      if(i + item[j] > 5000)
        continue;
      dp[i + item[j]] = min(dp[i + item[j]], dp[i] + price[j]);
    }
  }
  while(true)
  {
    int n;
    cin >> n;
    if(!n)
      break;

    cout << dp[n] << endl;
  }
}

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

int main(){
  int n;

  while(cin>>n,n){
    int ans = INT_MAX;

    for(int i=0;i*200<=10*n;i++){
      int aw = i * 200;
      for(int j=0;aw+j*300<=10*n;j++){
        int bw = j * 300;
        for(int k=0;aw+bw+k*500<=10*n;k++){
          int cw = k * 500;
          if(aw+bw+cw < n) continue;

          int calA = (i % 5) * 380 + (i / 5) * 5 * 380 * 0.8;
          int calB = (j % 4) * 550 + (j / 4) * 4 * 550 * 0.85;
          int calC = (k % 3) * 850 + (k / 3) * 3 * 850 * 0.88;

          ans = min(ans,calA+calB+calC);
        }
      }
    }

    cout<<ans<<endl;
  }
}

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

using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

#define MP make_pair<int,int>

int main(){
  while(true){
    int n;
    cin>>n;
    if(!n)break;
    int mnval = 1145141919;
    for(int a=0;a*200<=n;++a){
      for(int b=0;a*200+b*300<=n;++b){
        int _c = n - (a*200+b*300);
        if(_c%500!=0)continue;
        int c = _c/500;
        int val = 0;
        val += 380*5*4/5*(a/5);
        val += 380*(a%5);
        val += 550*4*17/20*(b/4);
        val += 550*(b%4);
        val += 850*3*22/25*(c/3);
        val += 850*(c%3);
        mnval = min(mnval,val);
      }
    }
    cout<<mnval<<endl;
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
#include <algorithm>

#define int64 long long int

using namespace std;

int main()
{
	int n, A, B, C, a, b, c, price, lowprice;
	
	while(1){
		cin >> n;
		if(n == 0) break;

		lowprice = 10000000;

		A = n / 200;
		B = n / 300;
		C = n / 500;

		for(a=0; a<=A; a++){
			for(b=0; b<=B; b++){
				for(c=0; c<=C; c++){
					if(a*200 + b*300 + c*500 != n) continue;
					price = 0;

					price += ((a/5)*5*380*80)/100 + (a%5)*380;
					price += ((b/4)*4*550*85)/100 + (b%4)*550;
					price += ((c/3)*3*850*88)/100 + (c%3)*850;

					if(price < lowprice) lowprice = price;
				}
			}
		}

		cout << lowprice << endl;
	}

	return 0;
}

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

using namespace std;

int dp[55];
int weight[6] = { 2 ,3 ,5 ,10 ,12 ,15 };
int value[6] = { 380 ,550 ,850 ,1520 ,1870 ,2244 };

void compute(void){
  
  for( int i = 0 ; i < 100 ; i++ ) dp[i] = 99999;;
  dp[0] = 0;
  for( int i = 0 ; i < 6 ; i++ ){
    for( int j = 0 ; j + weight[i] < 55 ; j++ ){
	dp[j + weight[i]] = min( dp[j + weight[i]] , dp[j] + value[i] );
      // 値段はvalueの6種類のみだからづいじそのパターンで計算
    }
  }

}

int main(void){

  compute();

  int n;
  while( cin >> n , n ){
    cout << dp[n/100] << endl;
  }
  return 0;
}

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