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 <stdio.h>
#include <limits.h>

int main(void)
{
	int i;
	int soba;
	int mp;
	int p;
	int n;
	
	while (scanf("%d", &soba), soba != 0){
		mp = INT_MAX;
		if (soba % 200 > 0){
			n = soba / 200 + 1;
		}
		else {
			n = soba / 200;
		}
		p = (380 * (n / 5 * 5)) * 0.8 + 380 * (n - n / 5 * 5);
		
		if (p < mp) mp = p;
		
		if (soba % 300 > 0){
			n = soba / 300 + 1;
		}
		else {
			n = soba / 300;
		}
		p = (550 * (n / 4 * 4)) * 0.85 + 550 * (n - n / 4 * 4);
		if (p < mp) mp = p;
		
		if (soba % 500 > 0){
			n = soba / 500 + 1;
		}
		else {
			n = soba / 500;
		}
		p = (850 * (n / 3 * 3)) * 0.88 + 850 * (n - n / 3 * 3);
		if (p < mp) mp = p;
		
		printf("%d\n", mp);
	}
	return (0);
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	int q[] = { 2, 3, 5 };
	int v[] = { 380, 550, 850 };
	int dq[] = { 5, 4, 3 };
	double dis[] = { 0.2, 0.15, 0.12 };
	int g;
	int vv[3][51];
	for (int i = 0; i < 3; ++i)
	{
		for (int j = 0; j < 51; ++j)
		{
			if (j % q[i] != 0)
			{
				vv[i][j] = 100000000;
				continue;
			}
			int sack = (j+q[i]-1) / q[i];
			int disSack = sack / dq[i] * dq[i];
			vv[i][j] = v[i]*sack - (int)(v[i]*disSack*dis[i]);
		}
	}

	int dp[3+1][51];
	for (int i = 0; i < 4; ++i)
		for (int j = 0; j < 51; ++j)
		dp[i][j] = 1000000;
	dp[0][0] = 0;

	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 51; ++j)
			for (int k = 0; k+j < 51; ++k)
				dp[i+1][j+k] = min(dp[i+1][j+k], dp[i][j] + vv[i][k]);

	while (true)
	{
		int g;
		scanf("%d", &g);
		if (g == 0) break;
		printf("%d\n", dp[3][g/100]);
	}

	return 0;
}

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

int volume[6] = { 200, 300, 500, 1000, 1200, 1500 };
int value[6]  = { 380, 550, 850, 1520, 1870, 2244 };
int n;
int dp[7][51];

int main()
{
	while (cin >> n, n)
	{
		for (int i = 0; i < 7; i++)
		{
			for (int j = 0; j < 51; j++)
			{
				dp[i][j] = 99999999;
			}
		}

		dp[0][0] = 0;
		for (int i = 1; i < 7; i++)
		{
			for (int j = 0; j < 51; j++)
			{
				int vol = volume[i - 1] / 100;
				int val = value[i - 1];
				if (j - vol < 0)
				{
					dp[i][j] = dp[i - 1][j];
				}
				else
				{
					dp[i][j] = min(dp[i - 1][j], dp[i][j - vol] + val);
				}
			}
		}

		cout << dp[6][n / 100] << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


typedef long long LL;

LL calc( int n, int value, int k, double p ) {
    return (int)( n / k * k ) * value * p + ( n % k ) * value;
}

LL solve( int n ) {
    LL res = INT_MAX;
    int W[3] = { 200, 300, 500 };
    int V[3] = { 380, 550, 850 };
    int K[3] = { 5, 4, 3 };
    double P[3] = { 0.8, 0.85, 0.88 };
    for ( int a = 0; a < 100; ++ a ) {
        for ( int b = 0; b < 100; ++ b ) {
            for ( int c = 0; c < 100; ++ c ) {
                int sumW = W[0] * a + W[1] * b + W[2] * c;
                if ( sumW != n ) continue;
                res = min( res,
                           calc( a, V[0], K[0], P[0] )
                           + calc( b, V[1], K[1], P[1] )
                           + calc( c, V[2], K[2], P[2] ));
            }
        }
    }
    return res;
}

int main() {
    int n;
    while ( cin >> n && n ) {
        cout << solve( n ) << endl;
    }
    return 0;
}

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

using namespace std;

int main(){

	int quan;
	while(cin>>quan&&quan!=0){
		int minCost=100000000;
		for(int i = 0; i <= 25; i++){
			for(int j = 0; j <= 17; j++){
				for(int k = 0; k <= 10; k++){
					if(i*200+j*300+k*500>=quan){
						int il=i%5;
						int jl=j%4;
						int kl=k%3;
						int sum=(i-il)*380*0.8+il*380;
						sum+=(j-jl)*550*0.85+jl*550;
						sum+=(k-kl)*850*0.88+kl*850;
						minCost=min(minCost,sum);
					}
				}
			}
		}
		cout<<minCost<<endl;
	}

	return 0;
}

C++: #include <stdio.h>

int main() {
  int stack[50], sp = 0, n, i, sum;
  while (scanf("%d", &stack[sp++]) != EOF)
    ;
  for (i = 0; i < sp; i++) {
    int ans = 1000000;
    n = stack[i];
    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++) {
          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) {
            if (sum < ans)
              ans = sum;
          }
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int g;
  
  /*
  cout << 380*5*0.80 << endl;
  cout << 550*4*0.85 << endl;
  cout << 850*3*0.88 << endl;
  
  cout << 380*15 << endl;
  cout << 550*10 << endl;
  cout << 850*6 << endl;*/

  int ans;

  while(cin >> g, g){
    ans = 0;
    while(g != 0){
      
      if(g >= 2700){
	ans += 4014;
	g -= 2700;
      }
      
      else if(g >= 2500){
	ans += 3764;
	g -= 2500;
      }
  
      else if(g >= 2200){
	ans += 3390;
	g -= 2200;
      }
      
      else if(g >= 1500){
	ans += 2244;
	g -= 1500;
      }
      else if(g >= 1200){
	ans += 1870;
	g -= 1200;
      }
      else if(g >= 1000){
	ans += 1520;
	g -= 1000;
      }
      else if(g >= 500){
	ans += 850;
	g -= 500;
      }
      else if(g >= 300){
	ans += 550;
	g -= 300;
      }
      else if(g >= 200){
	ans += 380;
	g -= 200;
      }
    }
    cout << ans << endl;
  }
  return 0;
}