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>

int main(void){
	
	int a,b,c,i,j,k,sobako,kingaku[850]={0},sum,temp,count;
	int ahiki,a_amari,bhiki,b_amari,chiki,c_amari;
	int a_weight,b_weight,c_weight;
	
	while(1){
		
		count=0;
		sobako=0;
		a=380; 
		b=550; 
		c=850; 
		a_weight=200;	
		b_weight=300;
		c_weight=500;
		
		for(i=0;i<850;i++){
			kingaku[i]=0;
		}
		
		scanf("%d",&sobako);
		
		if(sobako==0){
			break;
		}

		for(i=0;i<25;i++){
			for(j=0;j<17;j++){
				for(k=0;k<11;k++){
					sum=a_weight*i+b_weight*j+c_weight*k;
					if(sum==sobako){
						
						ahiki=i/5;	
						a_amari=i%5; 
						
						bhiki=j/4;
						b_amari=j%4;
						
						chiki=k/3;
						c_amari=k%3;
						
						kingaku[count]=(5*ahiki*0.80+a_amari)*a+(4*bhiki*0.85+b_amari)*b+(3*chiki*0.88+c_amari)*c;
						
						count++;			
					}
				}
			}
		}

		for(i=0;i<count-1;i++){
			for(j=(count-1);j>i;j--){
				if(kingaku[j-1]>kingaku[j] && kingaku[j]!=0 && kingaku[j-1]!=0){
					temp=kingaku[j-1];
					kingaku[j-1]=kingaku[j];
					kingaku[j]=temp;
				}
			}
		}
		
		printf("%d\n",kingaku[0]);
	
	}
	return 0;
}

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



int main(void){
    int n;
    int price;
    while(1){
        cin>>n;
        if(n==0) return 0;
        double price=1000000;


        for(int a=0;a<=(5000/200)+1;a++){
            for(int b=0;b<=(5000/300)+1;b++){
                for(int c=0;c<=(5000/500)+1;c++){
                    if(a*200+b*300+c*500 !=n) continue;

                    price=min(price,(a%5)*380+(a/5)*5*380*0.8+(b%4)*550+(b/4)*4*550*0.85+(c%3)*850+(c/3)*3*850*0.88);

                }
            }
        }
        cout<<price<<endl;

    }
}

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

using namespace std;

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int ans;

      int tmp=n,sum=0;
      //A
      for(;tmp>0;)
	{
	  if(tmp>799)
	    {
	      tmp-=1000;
	      sum+=380*5*0.8;
	    }
	  else
	    {
	      tmp-=200;
	      sum+=380;
	    }	    
	}
      ans=sum;
      tmp=n;
      sum=0;
      //B
      for(;tmp>0;)
	{
	  if(tmp>1199)
	    {
	      tmp-=1200;
	      sum+=550*4*0.85;
	    }
	  else
	    {
	      tmp-=300;
	      sum+=550;
	    }	    
	}
      ans=min(ans,sum);
      tmp=n;
      sum=0;

      //C
      for(;tmp>0;)
	{
	  if(tmp>1499)
	    {
	      tmp-=1500;
	      sum+=850*3*0.88;
	    }
	  else
	    {
	      tmp-=500;
	      sum+=850;
	    }	    
	}
      ans=min(ans,sum);
      tmp=n;
      sum=0;

      cout<<ans<<endl;
    }
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime> 

using namespace std;
const int INF=10000000;

int g[6]={2,3,5,10,12,15},p[6]={380,550,850,1520,1870,2244};

int main(void){
	int n;
	int a,b;
	int dp[51];
	for(a=0;a<=50;a++)dp[a]=INF;
	dp[0]=0;
	for(a=0;a<6;a++){
		for(b=0;b+g[a]<=50;b++){
			dp[b+g[a]]=min(dp[b+g[a]],dp[b]+p[a]);
		}
	}
	dp[1]=380;
	while(1){
		cin >> n;
		if(n==0)break;
		cout << dp[n/100] <<endl;
	}
	return 0;
}

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

using namespace std;

int dfs(int a, int b, int c, int n);
int calcAmount(int a, int b, int c);
int calcValue(int a, int b, int c);

int main() {
    int a, b, c;

    int n;

    while (cin >> n) {
        if(n == 0) break;
        a = 0; b = 0; c = 0;
        
        cout << dfs(a, b, c, n) << endl;
    }

        return 0;
}

int dfs(int a, int b, int c, int n) {
    int amount = calcAmount(a, b, c);

    if(amount == n) {
        return calcValue(a, b, c);
    } else if(amount > n) {
        return INT_MAX;
    } else {
        return min(min(dfs(a+1, b, c, n), dfs(a, b+1, c, n)), dfs(a, b, c+1, n));
    }
}

int calcAmount(int a, int b, int c) {
    return a*200 + b*300 + c*500;
}

int calcValue(int a, int b, int c) {
    a = 380*(a/5)*4 + 380*(a%5);
    b = 550*(b/4)*17/5 + 550*(b%4);
    c = 850*(c/3)*264/100 + 850*(c%3);

    return a+b+c;
}

C++: #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <vector>

using namespace std;

int s=99999999;

void kakerukamosirenai(int total,int left,int a,int b,int c){
	if(left>0){
		kakerukamosirenai(total+380,left-200,a+200,b,c);//a
		kakerukamosirenai(total+550,left-300,a,b+300,c);//b
		kakerukamosirenai(total+850,left-500,a,b,c+500);//c
	}else if(left==0){
		while(a>=1000){
			a-=1000;
			total -= 380;
		}

		while(b>=1200){
			b-=1200;
			total -= 330;
		}

		while(c>=1500){
			c-=1500;
			total -= 306;
		}

		if(s>total){
			s = total;
		}
	}else{
//		cout << "erratta" <<endl;
	}
}

int main(){

	vector<int> p;
	int n,c=0,a,t;

	while(1){
		c++;
		cin >> n;
		p.push_back(n);
		if(p[c]==0)break;
	}

	for(int i=0;i<c-1;i++){
		kakerukamosirenai(0,p[i],0,0,0);
		cout << s << endl;
		s = 999999999;
	}

	return 0;
}

C++: include <iostream>
#include <vector>
using namespace std;
#define MAXVALUE (1<<21)
vector<int> dp(5000+1,MAXVALUE);

void init(){
	int item[6] = {200,300,500,1000,1200,1500};
	int price[6]= {380,550,850,1520,1870,2244};
	
	dp[0]=0;

	for(int k=0;k<6;k++){
		for(int i=0;i+item[k]<=5000;i++){
			dp[i+item[k]] = min( dp[i+item[k]] , dp[i]+price[k] );
		}
	}
}

int main(){
	init();
	int n,mi;
	while(cin >> n && n){
		mi = dp[n];
		/*for(int i=n;i<=5000;i++){
			mi = min(dp[i],mi);
		}*/
		cout << mi << endl;
	}
}

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

int dp[51];

void make() {
  const int weight[6] = {2, 3, 5, 10, 12, 15};
  const int price[6] = {380, 550, 850,
			int(380*5*(1.0-0.2)+0.5),
			int(550*4*(1.0-0.15)+0.5),
			int(850*3*(1.0-0.12)+0.5)};
  dp[0] = 0;
  for(int w = 1; w <= 50; ++w) {
    dp[w] = INF;
    for(int i = 0; i < 6; ++i) {
      int p = w - weight[i];
      if(p < 0) continue;
      dp[w] = min(dp[w], price[i] + dp[p]);
    }
  }
}

main() {
  int W;
  make();
  while((cin >> W) && W) cout << dp[W/100] << endl;
}

C++: #include <cstdio>
#define INF 1000000000

int price;
int weight;

int main() {
  while(scanf("%d", &weight), weight) {
    price = INF;
    for (int i=0; i<=25; i++) {
      for (int j=0; j<=16; j++) {
	for (int k=0; k<=10; k++) {
	  int w = i*200 + j*300 + k*500;
	  if (weight == w) {
	    int calc_price = 
	      ((i/5)*5) * 380 * 0.8 + (i%5)*380
	      + ((j/4)*4) * 550 * 0.85 + (j%4)*550
	      + ((k/3)*3) * 850 * 0.88 + (k%3)*850;
	    if (price > calc_price) {
	      price = calc_price;
	    }
	    break;
	  } else if (weight < w) {
	    break;
	  }
	}
      }
    }	

    printf("%d\n", price);
  }
}