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++: //32
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    int mc=1<<30;
    for(int a=0;a*200<n+200;a++){
      for(int b=0;a*200+b*300<n+300;b++){
	for(int c=0;a*200+b*300+c*500<n+500;c++){
	  if(a*200+b*300+c*500==n){
	    int cst=a*380+b*550+c*850-(a/5)*380*20*5/100-(b/4)*550*15*4/100-(c/3)*850*12*3/100;
	    mc=min(cst,mc);
	  }
	}
      }
    }
    cout<<mc<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
 
int main() {
 
  while(1) {
 
    int n;
    cin >> n;
    if(n == 0) break;
 
    int min = 1000000;
    int fee;
    for(int i=0;i<=n/200+1;i++) {
      for(int j=0;j<=n/300+1;j++) {
    for(int k=0;k<=n/500+1;k++) {
      if(i*200+j*300+k*500 == n) {
        fee = i*380 + j*550 + k*850;
        if(i>=5) fee += ((i/5)*5*380)*0.8 -(i/5*5*380);
        if(j >=4)fee += ((j/4)*4*550)*0.85 -(j/4*4 * 550);
        if(k>=3) fee += ((k/3)*3*850)*0.88 -(k/3*3 * 850);
        //cout <<i<<"*"<<j<<"*"<<k<<"="<< fee << endl;
        if(min > fee) min = fee;
      }
    }
      }
    }
 
    cout << min << endl;
  }
 
  return 0;
 
}

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

using namespace std;

int soba[][2] = {
	{200, 380},
	{300, 550},
	{500, 850}
};

int main() {
	int n, m = 5000 * 500;
	cin >> n;
	if (n == 0){
		return 0;
	}
	for (int i = n / soba[2][0] + 1; i >= 0; i--) {
		for (int j = n / soba[1][0] + 1; j >= 0; j--) {
			for (int k = n / soba[0][0] + 1; k >= 0; k--) {
				int w = i * soba[2][0] + j * soba[1][0] + k * soba[0][0];
				if (w >= n) {
					int p = (int)(i / 3 * 3 * soba[2][1] * 0.88) + (int)(i % 3 * soba[2][1]) + (int)(j / 4 * 4 * soba[1][1] * 0.85) + (int)(j % 4 * soba[1][1]) + (int)(k / 5 * 5 * soba[0][1] * 0.8) + (int)(k % 5 * soba[0][1]);
					if (p < m) {
						m = p;
					}
				}
			}
		}
	}
	cout << m << endl;
	return main();
}

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

using namespace std;

const int ma = 1000000000;

///割引された値を単位に考える。→　余りを最安値で買う。(2変数)
///3変数では不可。→　全探索。

int main()
{
    while( 1 )
    {
        int n;
        scanf( "%d\n", &n );
        if( n == 0 )break;
        int mini = ma, num_a, num_b, num_c, index;
        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;
					    index = 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);
                        mini = min( mini, index );
                    }
                }
            }
        }
        printf( "%d\n", mini );
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int w[6]={200,300,500,1000,1200,1500};
int v[6]={380,550,850,38*5*8,11*2*85,2244};

int main(){
	vector<int> dp(5500,1e9);
	dp[0]=0;
	for(int i=0;i<6;i++){
		for(int j=0;j+w[i]<5500;j++){
			if(dp[j]==1e9)continue;
			dp[j+w[i]]=min(dp[j+w[i]],dp[j]+v[i]);
		}
	}
	int n;
	while(cin >> n,n){
		cout << dp[n] << endl;
	}
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int quantity[] = {200, 300, 500};
    int value[] = {380, 550, 850};
    int unit[] = {5, 4, 3};
    int discount[] = {20, 15, 12};

    vector<int> cost(51, INT_MAX/2);
    cost[0] = 0;
    for(int i=1; i<=50; ++i){
        for(int j=0; j<3; ++j){
            int k = i - quantity[j]/100;
            if(k >= 0)
                cost[i] = min(cost[i], cost[k] + value[j]);

            k = i - quantity[j]/100 * unit[j];
            if(k >= 0)
                cost[i] = min(cost[i], cost[k] + value[j] * unit[j] * (100-discount[j]) / 100);
        }
    }

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;
        cout << cost[n/100] << endl;
    }
}

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; //200g 5Ü20%ø«
		b=550; //300g 4Ü15%ø«
		c=850; //500g 3Ü12%ø«
		a_weight=200;	//êÜÌd³
		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;	//øªKp³êéÜÌÂ
						a_amari=i%5; //øKpOÌÜÌÂ
						
						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;i++){
			printf("kingaku[%d]=%d\n",i,kingaku[i]);
		}*/
		
		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;
				}
			}
		}
		
		/*for(i=0;i<count;i++){
			printf("kingaku[%d]=%d\n",i,kingaku[i]);
		}*/
		printf("%d\n",kingaku[0]);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

int dp[4][10000];
int v[3] = { 2,3,5 }, w[3] = { 380,550,850 };

int main() {
	memset(dp, 127, sizeof(dp));
	dp[0][0] = 0;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 9000; j++) {
			for (int k = j; k < 10000; k += v[i]) {
				dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + (k - j) / v[i] * w[i]);
			}
		}
	}
	while (true) {
		int n;
		cin >> n;
		if (n == 0) { break; }
		cout << dp[3][n / 100] << endl;
	}
	return 0;
}