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>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 10000000;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0106 : Discounts of Buckwheat **/
int main()
{
	int price[5000]; fill(price, price+5000, INF);
	rep(a, 25) {
		rep(b, 25) {
			rep(c, 25) {
				int g = 200*a + 300*b + 500*c;
				int p = 380*a - (a/5*380*0.2*5) + b*550 - (b/4*550*0.15*4) + c*850 - (c/3*850*0.12*3);
				
				if (g>5000) continue;
				price[g] = min(price[g], p);
			}
		}
	}
	
	int in;
	while (cin>>in, in) {
		cout << price[in] << endl;
	}
}

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

int main(){
	int n,mi;
	while (1){
		mi = 100000000;
		cin >> n;
		if (!n) break;
		for (int i = 0; i <= n / 500; i++){
			for (int j = 0; j <= (n - i * 500) / 300; j++){
				if ((n - i * 500 - j * 300) % 200) continue;
				int k = (n - i * 500 - j * 300) / 200;
				mi = min(mi, (int)(380 * (k / 5) * 5 * 0.8 + 380 * (k % 5) + 550 * (j / 4) * 4 * 0.85 + 550 * (j % 4) + 850 * (i / 3) * 3 * 0.88 + 850 * (i % 3)));
			}
		}
		cout << mi << endl;
	}
	return 0;
}

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

#define Kinds 6
#define DP 55
const int cost[Kinds]={380,550,850,(int)(380*5*0.8),(int)(550*4*0.85),(int)(850*3*0.88)};
const int Volume[Kinds]={200,300,500,1000,1200,1500};

unsigned int dp[DP];

int main(){
	int n;
	
	std::fill(dp,dp+DP,10000000);
	dp[0]=0;
	for(int i=0;i<DP;++i)
		for(int l=0;l<Kinds;++l)
			if(i-Volume[l]/100>=0)
				dp[i]=std::min(dp[i],dp[i-Volume[l]/100]+cost[l]);
	while( std::cin>>n, n )
		std::cout<<dp[n/100]<<std::endl;
	
	return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

double g, cost;

/*void solve(int a, int b, int c, int j, int mincost){
	if (j > g)return;
	if (a % 5 == 0 && a)mincost *= 0.8;
	if (b % 4 == 0 && b)mincost *= 0.85;
	if (c % 3 == 0 && c)mincost *= 0.88;
	if (j == g){
		cost = min(cost, mincost);
		return;
	}
	cout << mincost << endl;
	solve(a + 1, b, c, j + 200, mincost + 380);
	solve(a, b + 1, c, j + 300, mincost + 550);
	solve(a, b, c + 1, j + 500, mincost + 850);
}*/

int main(){
	while (cin >> g&&g){
		cost = INF;
		int co1 = 0, co2 = 0, co3 = 0;
		for (int i = 0; i <= 5000; i += 200){
			co1 = i / 200;
			for (int j = 0; i+j <= 5000; j += 300){
				co2 = j / 300;
				for (int k = 0; i + j + k <= 5000; k += 500){
					co3 = k / 500;
					if (i + j + k == g){
						cost = min(cost, 380*(co1-co1%5)*0.8+380*(co1%5)
							+550*(co2-co2%4)*0.85+550*(co2%4)
							+850*(co3-co3%3)*0.88+850*(co3%3));
					}
				}
			}
		}
		cout << cost << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int f(int a, int b, int c) {
	int r = 0;
	r += (a % 5) * 380;
	r += (a / 5) * 1520;
	r += (b % 4) * 550;
	r += (b / 4) * 1870; 
	r += (c % 3) * 850;
	r += (c / 3) * 2244;
	return r;
}
int main() {
	int n;
	while (cin >> n, n) {
		int ans = 114514;
		for (int i = 0; i <= 10; i++) {
			for (int j = 0; j <= 10; j++) {
				for (int k = 0; k <= 10; k++) {
					if (i * 200 + j * 300 + k * 500 == n)ans = min(ans, f(i, j, k));
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
	int m;
	while(cin>>m&&m){
		int ans=1<<30;
		for(int i=0;i<300;i++){
			int a=i/3*3*850*88/100;
			a += i%3*850;
			for(int j=0;j<300;j++){
				int b=j/4*4*550*85/100;
				b += j%4*550;
				int k=(m-i*500-j*300+199)/200,c=0;
				if(0<k){
					c=k/5*5*380*80/100;
					c += k%5*380;
				}
				ans=min(ans,a+b+c);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

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




int main(void){
	int n;
	while(scanf("%d", &n) &&n ){
		int dp[5000001] ={0};
		dp[0] = 0;
		
		for(int i = 1; ; i++){
			for(int j = 0; j < 6; j++){
				if(i-price[j] < 0)continue;
				dp[i] = max(dp[i-price[j]]+weight[j],dp[i]);
			}
			if(dp[i]>=n){
				printf("%d\n",i);
				break;
			}
		}
	}
	return 0;
}

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

using namespace std;

int dp[10000000];

int main()
{
	for(;;){
		int n;		//d³
		int g[6] 	= {200, 300, 500, 1000, 1200, 1500};
		int kane[6] = {380, 550, 850, 1520, 1870, 2244};
		
		fill(dp,dp+1000000, 10000000);
		
		dp[0] = 0;
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		//d³ÜÅ
		for(int i = 0; i <= n*2; i+=100){
			for(int j = 0; j < 6; j++){
				if(i-g[j] < 0){
					continue;
				}
				if(dp[i-g[j]]+kane[j] < dp[i]){
					dp[i] = dp[i-g[j]]+kane[j];
				}
			}
		} 
		 
		for(int i = 0; i <= n*2; i+= 100){
			
			for(int j = 1;; j++){
				if(dp[i] < dp[i+j*100]){
					break;
				}
				else{
					dp[i] = dp[i+j*100];
				//	cout <<"*" <<dp[i] << endl;
				}
			}
	//		cout << dp[i] << endl;
		}
		
		
		
		cout << dp[n] << endl;
	}
	
	return 0;
}

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

using namespace std;

int ret;
int w;

void solve(int tmpw, int c){
  //cout << "tmpw = " << tmpw << endl;
  if(c >= ret) return;
  if(tmpw <= 0){
	ret = min(ret, c);
	return;
  }
  if(c+850*3*0.88 < ret){
	solve(tmpw-1500, c+850*3*0.88);
  }
  if(c+380*5*0.8 < ret){
	solve(tmpw-1000, c+380*5*0.8);
  }
  if(c+550*4*0.85 < ret){
	solve(tmpw-1200, c+550*4*0.85);
  }
  if(c+850 < ret){
	solve(tmpw-500, c+850);
  }
  if(c+550 < ret){
	solve(tmpw-300, c+550);
  }
  if(c+300 < ret){
	solve(tmpw-200, c+380);
  }
  
  return;
}

int main(void){
  while(cin >> w && w){
	ret = 1 << 30;
	solve(w,0);
	cout << ret << endl;
  }
}