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 <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

int N;

void func(){

	int minimum = BIG_NUM,num_a,num_b,num_c,tmp;

	for(int a = 0; a <= N; a += 200){
		for(int b = 0; b <= N; b += 300){
			if(a+b > N)break;
			for(int c = 0; c <= N; c += 500){
				if(a+b+c > N)break;

				if(a+b+c == N){
					num_a = a/200;
					num_b = b/300;
					num_c = c/500;
					tmp = 380*(num_a%5)+550*(num_b%4)+850*(num_c%3)+304*(num_a - num_a%5)+1870*(num_b-num_b%4)/4+748*(num_c-num_c%3);
					minimum = min(minimum,tmp);
				}
			}
		}
	}
	printf("%d\n",minimum);

}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	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.8 + 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**** dp = new int***[25+1];
	for(int i=0;i<=25;i++){
		dp[i] = new int**[17+1];
		for(int j=0;j<=17;j++){
			dp[i][j] = new int*[10+1];
			for(int k=0;k<=10;k++){
				dp[i][j][k] = new int[50+1];
			}
		}
	}

	for(int i=0;i<=25;i++){
		for(int j=0;j<=17;j++){
			for(int k=0;k<=10;k++){
				for(int l=0;l<=50;l++){
					dp[i][j][k][l] = 100000000;
				}
			}
		}
	}

	dp[0][0][0][0] = 0;

	for(int a=0; a<=25;a++){
		for(int b=0; b<=17;b++){
			for(int c=0; c<=10;c++){
				for(int w=0; w<=50; w++){
					if(w - a*2 >= 0){
						dp[a][b][c][w] = min(dp[a][b][c][w],dp[0][b][c][w-a*2]+buy_A(a));
					}
					if(w - b*3 >= 0){
						dp[a][b][c][w] = min(dp[a][b][c][w],dp[a][0][c][w-b*3]+buy_B(b));
					}
					if(w - c*5 >= 0){
						dp[a][b][c][w] = min(dp[a][b][c][w],dp[a][b][0][w-c*5]+buy_C(c));
					}
				}
			}
		}
	}

	int W;
	while(~scanf("%d",&W)){
		if(W==0) break;
		W/=100;
		int res=100000000;
		for(int i=0;i<=25;i++){
			for(int j=0;j<=17;j++){
				for(int k=0;k<=10;k++){
					res=min(res,dp[i][j][k][W]);
				}
			}
		}
		cout << res << endl;
	}


}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int g[] = {1500,1200,1000,500,300,200};
int c[] = {2244,1870,1520,850,550,380};

int dp[11][5555];
int solve(int i,int n){
  if(i > 5) return 1<<28;
  if(n <= 0) return 0;
  if(dp[i][n]) return dp[i][n];
  return dp[i][n] = min(n >= g[i]?solve(i,n-g[i])+c[i]:1<<28,solve(i+1,n));
}

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

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=r[i];j<=mokuhyou/100;j+=r[i]){
	double as=(aa/rr[i])*rr[i];
	dp[i][j]=min(dp[i-1][j],(n[i]*(aa-as))+((n[i]*as)*nn[i]));
	aa++;
      }
      for(int j=r[i];j<=mokuhyou/100;j++){
	dp[i][j]=min(dp[i-1][j],dp[i][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++;
	}
      }
    }
    cout<<dp[3][mokuhyou/100]<<endl;
  }
}

C++: #include<iostream>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#define INF 100000
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int moneyA(int gram){
	int n=gram/200;
	int res=gram%200;
	if(res)return INF;
	int money=0;
	int sell=n/5;
	int normal=n%5;
	money=(int)((double)sell*5*380*0.8)+normal*380;
	return money;
}

int moneyB(int gram){
	int n=gram/300;
	int res=gram%300;
	if(res)return INF;
	int money=0;
	int sell=n/4;
	int normal=n%4;
	money=sell*4*550*0.85+normal*550;
	return money;
}

int moneyC(int gram){
	int n=gram/500;
	int res=gram%500;
	if(res)return INF;
	int money=0;
	int sell=n/3;
	int normal=n%3;
	money=sell*3*850*0.88+normal*850;
	return money;
}
int main(){
	int want;
	while(cin>>want,want){
		cout<<min(min(moneyA(want),moneyB(want)),moneyC(want))<<endl;
	}
	return 0;
}

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

using namespace std;

int main() {
  int n;
  int weight[] = {200, 300, 500, 1000, 1200, 1500};
  int price[] = {380, 550, 850, 380*5*0.8, 550*4*0.85, 850*3*0.88};
  const int MAXW = 5000;
  const int INF = 1<<23;
  vector<int> dp(2*MAXW, INF);
      
  for(int i=0; i<6; i++) dp[weight[i]] = price[i];
  for(int i=0; i<6; i++) {
    for(int j=0; j<=MAXW; j+=100) {
      if(j-weight[i] >= 0) {
	dp[j] = min(dp[j], dp[j-weight[i]] + price[i]);
      }
    }
  }
  
  while(cin >> n, n) {
    cout << dp[n] << endl;
  }
  
  return 0;
}

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

using namespace std;

int m[6] = {200, 300, 500, 1000, 1200, 1500};

int v[6] = {380, 550, 850, 1520, 1870, 2244};

int main(){
	int n;
	
	int price[10000];
	
	for(int i = 0; i < 10000; i++){
		price[i] = 1 << 30;
	}
	
	for(int i = 0; i < 6; i++){
		price[m[i]] = v[i];
	}
	
	for(int loop = 0; loop < 50; loop++){
		for(int i = 0; i <= 5000; i++){
			for(int j = 0; j < 6; j++){
				if(price[i + m[j]] > price[i] + v[j]){
					price[i + m[j]] = price[i] + v[j];
				}
			}
		}
	}
	
	cin >> n;
	
	while(n != 0){
		
		printf("%d\n", price[n]);
		
		cin >> n;
	}
	
	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(checkA(i)+checkB(j)+checkC(k),ans);
	  }
	}
      }
    }    
    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;
}