Go: package main

import "fmt"

func main() {
	maxGram := 5000
	// store := map[int]int{
	// 	1500: 2244, // 500 * 3
	// 	1200: 1870, // 300 * 4
	// 	1000: 1520, // 200 * 5
	// 	500:  850,
	// 	300:  550,
	// 	200:  380,
	// }

	for {
		var gram int
		fmt.Scanf("%d", &gram)

		if gram == 0 {
			return
		}

		var minPrice int

		// (x * 200) + (y * 300) + (z * 500) == gram
		for x := 0; (x * 200) <= maxGram; x++ {
			for y := 0; (y * 300) <= maxGram; y++ {
				for z := 0; (z * 500) <= maxGram; z++ {
					if (x*200)+(y*300)+(z*500) == gram {
						price := 0
						price += (z / 3) * 2244
						price += (z % 3) * 850
						price += (y / 4) * 1870
						price += (y % 4) * 550
						price += (x / 5) * 1520
						price += (x % 5) * 380

						if price < minPrice || minPrice == 0 {
							minPrice = price
						}
					}
				}
			}
		}

		fmt.Println(minPrice)
	}
}

// 1 袋あたりの量			200g	300g	500g
// 1 袋の単価(定価)		380円	550円	850円
// 割引が適用される単位		5袋毎	4袋毎	3袋毎
// 割引率							20%引き	15%引き	12%引き

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<string, int>P;

int main() {
	int n;
	while (cin >> n, n) {
		int Min = INT_MAX;
		rep(i, n / 200 + 1) {
			rep(j, n / 300 + 1) {
				rep(k, n / 500 + 1) {
					if (i * 200 + j * 300 + k * 500 == n) {
						Min = min(Min, 380 * i + 550 * j + 850 * k - i / 5 * 380 - j / 4 * 330 - k / 4 * 306);
					}
				}
			}
		}
		cout << Min << endl;
	}
}

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

int main()
{
    int dp[52];
    for(int i=0;i<52;i++){
        dp[i] = 1000000000;
    }
    dp[0] = 0;
    int weight[6] = {2,3,5,10,12,15};
    int price[6] = {380,550,850,1520,1870,2240};
    for(int i=0;i<52;i++){
        for(int j=0;j<6;j++){
            if(i-weight[j] >= 0)
                dp[i] = min(dp[i],dp[i-weight[j]]+price[j]);
        }
    }
    int n;
    while(cin >> n){
        if(n==0)
            break;
        cout << dp[n/100] << endl;
    }
    return 0;
}

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

int main(){

/*
	cout << "yen/g" << endl;
	cout << "A:" << 380 / 200.0 << ", " << 380 / 200.0 * 0.8 << endl;
	cout << "B:" << 550 / 300.0 << ", " << 550 / 300.0 * 0.85 << endl;
	cout << "C:" << 850 / 500.0 << ", " << 380 / 200.0 * 0.88 << endl;
*/

	int w, val;
	map<char, int> fix, dsc, weight;
	
	weight.insert(make_pair('A', 200));
	weight.insert(make_pair('B', 300));
	weight.insert(make_pair('C', 500));
	
	fix.insert(make_pair('A', 380));
	fix.insert(make_pair('B', 550));
	fix.insert(make_pair('C', 850));
	
	dsc.insert(make_pair('A', 1520));
	dsc.insert(make_pair('B', 1870));
	dsc.insert(make_pair('C', 2244));
	
	while(cin >> w){
		if(w == 0) break;		
		
		val = 0;
		while(w > 1500){
			w -= weight['A'] * 5;
			val += dsc['A'];
		}
		switch(w){
			case 1500: val += dsc['C']; break;
			case 1400: val += dsc['B'] + fix['A']; break;
			case 1300: val += dsc['A'] + fix['B']; break;
			case 1200: val += dsc['B']; break;
			case 1100: val += fix['C'] + fix['B'] * 2; break;
			case 1000: val += dsc['A']; break;
			case 900: val += fix['C'] + fix['A'] * 2; break;
			case 800: val += fix['C'] + fix['B']; break;
			case 700: val += fix['C'] + fix['A']; break;
			case 600: val += fix['B'] * 2; break;
			case 500: val += fix['C']; break;
		}
		
		cout << val << endl;
		
	}

	return 0;

}

C++: #include <iostream>
#include<string>
#include<queue>
#include<utility>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
    int n,sum;
    while(1){
        sum=0;
        cin>>n;
        if(n==0)break;
        if((double)n/1200>=0.0){
            sum+=n/1200*550*4*0.85;
            n-=(n/1200)*1200;
        }
        if((double)n/1000>=0.0){
            sum+=n/1000*380*5*0.8;
            n-=(n/1000)*1000;
        }
        if(n>=500){
            sum+=n/500*850;
            n-=(n/500)*500;
        }
        if(n>=300){
            sum+=n/300*550;
            n-=(n/300)*300;
        }
        if(n>=200){
            sum+=n/200*380;
            n-=(n/200)*200;
        }
        cout<<sum<<endl;
        
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	int bw[][2]={{2,380},{3,550},{5,850},{10,1520},{12,1870},{15,2244}};
	int dp[51]={0};
	for(int i=1;i<51;++i){
		dp[i]=1e+9;
	}
	for(int i=0;i<51;++i){
		for(int j=0; j<6 ; ++j){
			if(i>=bw[j][0]){
					dp[i]= min(dp[i] , dp[i-bw[j][0]]+bw[j][1]); //dp[i]=((dp[iSize-jSize]+jValue < dp[i]) ? dp[iSize-jSize]+jValue : dp[i]);
			}
		}
	}
	while(cin >> n , n){
		cout << dp[n/100] << endl;
	}
	return 0;
}

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

int main(){
    map<int,int>m;
    for(int i=0;i*200<5001;i++){
        for(int j=0;j*300<5001;j++){
            for(int k=0;k*500<5001;k++){
                int w=i*200+j*300+k*500;
                int p=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(m[w])m[w]=min(m[w],p);
                else m[w]=p;
            }
        }
    }
    int n;
    while(cin>>n,n){
        cout<<m[n]<<endl;
    }
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>


using namespace std;

void Solution()
{
    const int weight[] = {2, 3, 5, 10, 12, 15}; //10 = 5袋買った時、12 = 4袋買った時, 15 = 3袋買った時
    const int value[] = {380, 550, 850, 1520, 1870, 2244}; //1520, 1870, 2244 = 割引がある時
    const int num = 6;
    
    int dp[52]; // 25 + 17 + 10
    
    int amount;
        
    for (int i = 0; i <= 52; i++)
    {
        dp[i] = 1000000000;
    }
    
    dp[0] = 0;
    
    for(int i = 0; i < 52; i++)
    {
        for(int j=0; j < num; j++)
        {
            if(i - weight[j] >= 0)
            {
                dp[i] = min(dp[i], dp[i - weight[j]] + value[j]);
            }
        }
    }
    
    while(cin>>amount)
    {
        if(amount == 0)
        {
            break;
        }
        
        cout<<dp[amount / 100]<<endl;
    }
}

int main()
{
    Solution();
    return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	long long int n, r, d, w, h, x;
	while (1) {
		cin >> d >> w >> h;
		if (d + w + h == 0)
			return 0;
		if (d <= h && w <= h)
			x = d * d + w * w;
		else if (d <= w && h <= w)
			x = d * d + h * h;
		else if (w <= d && h <= d)
			x = w * w + h * h;
		cout << x;
		cin >> n;
		for (int lop = 0; lop < n; lop++) {
			cin >> r;
			if (4*r*r >= x)
				cout << "OK\n";
			else
				cout << "NA\n";
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;
int n, ret;
int main() {
    while(true) {
        scanf("%d", &n);
        if(n == 0) break;
        ret = 999999999;
        for(int a = 0; a <= 25; a++) {
            for(int b = 0; b <= 16; b++) {
                for(int c = 0; c <= 10; c++) {
                    int value = a * 200 + b * 300 + c * 500;
                    if(n == value) {
                        ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 + (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850);
                    }
                }
            }
        }
        printf("%d\n", ret);
    }
    return 0;
}