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%引き

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def main(readline=stdin.readline):
    table = (0, 0, 380, 550, 760, 850, 1100, 1230, 1400, 1610, 1520,
             1950, 1870, 2070, 2250, 2370, 2620, 2720, 2920, 3100, 3040,
             3470, 3390, 3590, 3740, 3890, 4140, 4240, 4440, 4590, 4560,
             4990, 4910, 5110, 5260, 5410, 5660, 5760, 5960, 6110, 6080,
             6510, 6430, 6630, 6780, 6930, 7180, 7280, 7480, 7630, 7600)
    while 1:
        weight = int(readline())
        if not weight:
            exit()
        print(table[weight//100])


if __name__ == '__main__':
    main()

Python: # AOJ 0106 Discounts of Buckwheat 
# Python3 2018.6.18 bal4u

a = [ 2, 3, 5 ]
s = [ 380, 550, 850 ]
c = [ 10, 12, 15 ]
f = [ 1520, 1870, 2244 ]
tbl = [0]*60

def rec(i, v, cost):
	if i == 3:
		if (v <= 50 and tbl[v] == 0) or tbl[v] > cost: tbl[v] = cost
		return
	for j in range(0, 51-v, a[i]):
		cc = j // c[i] * f[i] + (j % c[i]) // a[i] * s[i]
		rec(i+1, v+j, cost+cc)

rec(0, 0, 0)
while True:
	n = int(input())
	if n == 0: break
	print(tbl[n//100])

Python: while True:
    g = int(input())//100
    if g == 0:
        break
    p = 100000
    for a in range(g//2 + 1):
        for b in range(g//3 + 1):
            for c in range(g//5 + 1):
                if a*2 + b*3 + c*5 == g:
                    p = min(p, 1520*(a//5) + 380*(a%5) + 1870*(b//4) + 550*(b%4) + 2244*(c//3) + 850*(c%3))
    print(p)

Python: INF = 10**20
def solve(n):
    inf = INF
    for i in range((n//500) + 1):
        for j in range(((n - 500*i)//300) + 1):
            if ((n - 500*i - 300*j)%200 == 0):
                a = (n - 500*i - 300*j)//200
                va = (a//5)*380*5*0.8 + (a%5)*380
                vj = (j//4)*550*4*0.85 + (j%4)*550
                vi = (i//3)*850*3*0.88 + (i%3)*850
                inf = min(inf, va+vj+vi)
    print(int(inf))
            
while True:
    n = int(input())
    if (not n):
        break
    solve(n)

Python: P = [2, 10, 3, 12, 5, 15]
Q = [380, 1520, 550, 1870, 850, 2244]
MAX = 50
Range = [0] + [1000000] * MAX

for p, q in zip(P, Q):
    for i in range(MAX - p + 1):
        Range[i + p] = min(Range[i + p],Range[i] + q)
while 1:
    v = int(input())
    if v == 0:
        break
    print(Range[v // 100])

Python: """ 
A店：200g,380y,20%/5 → 1.9y/g
B店：300g,550y,15%/4 → 1.83y/g
C店：500g,850y,12%/3 → 1.7y/g
380*5 *0.8 = 1520   304/1つ
550*4 *0.85 = 1870  467.5/1つ
850*3 *0.88 = 2244  748/1つ
"""
# 購入数は50g刻みと明言されているので

P = [2,10, 3,12, 5,15]
Q = [380,1520, 550,1870, 850,2244]
MAX = 50
Range = [0] + [1000000]*MAX

for p,q in zip(P,Q):
    for i in range(MAX - p+1):
        Range[i+p] = min(Range[i+p],Range[i]+q)

while True:
    v = int(input())
    if v==0:
        break
    print(Range[v//100])

Python: import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


while True:

    N = int(input()) #量
    if N == 0:
        break

    ans = BIG_NUM

    lim_A = N//200
    lim_B = N//300
    lim_C = N//500

    for a in range(lim_A+1):
        for b in range(lim_B+1):
            if 200*a+300*b > N:
                break
            rest = N-(200*a+300*b)
            if rest%500 != 0:
                continue
            c = rest//500

            sum_A = 380*(a%5)+304*(a-(a%5))
            sum_B = 550*(b%4)+935*(b-(b%4))//2
            sum_C = 850*(c%3)+1496*(c-(c%3))//2

            ans = min(ans,sum_A+sum_B+sum_C)

    print("%d"%(ans))

Python: while True:
	amount = int(input())
	decide = [0,0,0,0,0,0]
	unit = [200,300,500,1000,1200,1500]
	m_unit = [320,550,850,1520,1870,2244]
	n = amount
	res = 0
	if n == 0:
		break
	while n != 0:
		for i in [5,4,3,2,1,0]:
			if n >= unit[i]:
				decide[i] += 1
				n -= unit[i]
			if n < 200:
				for j in [5,4,3,2,1,0]:
					if decide[j] != 0:
						decide = [0,0,0,0,0,0]
						decide[j-1] += 1
						n = amount-unit[j-1]
	for i in range(6):
		res += decide[i]*m_unit[i]
	print(res)

Python: a=[1e4]*51
for i,j in[(2,380),(3,550),(5,850),(10,1520),(12,1870),(15,2244)]:
 a[i]=j
 for k in range(51-i):a[k+i]=min(a[k]+j,a[k+i])
for n in iter(input,'0'):print(a[int(n)//100])

Python: while True:
    N = int(input())
    if not N: break
    ans = float('inf')
    for c200 in range(N//200+1):
        for c300 in range(N//300+1):
            for c500 in range(N//500+1):
                if 200 * c200 + c300 * 300 + c500 * 500 == N:
                    ans = min(ans, 1520*(c200//5)+380*(c200%5)+1870*(c300//4)+550*(c300%4)+2244*(c500//3)+850*(c500%3))
    print(ans)

Python: # -*- coding: utf-8 -*-

import sys
import os

for s in sys.stdin:
    n = int(s)
    if n == 0:
        break

    costs = []
    for a in range(0, 26):
        for b in range(0, 17):
            for c in range(0, 11):
                # candidate
                if a * 200 + b * 300 + c * 500 == n:
                    cost = 0
                    a_bulk_num = a // 5
                    a_price_down_num = a_bulk_num * 5
                    a_normal_price_num = a - a_price_down_num
                    cost += 380 * 0.8 * a_price_down_num + 380 * a_normal_price_num

                    b_bulk_num = b // 4
                    b_price_down_num = b_bulk_num * 4
                    b_normal_price_num = b - b_price_down_num
                    cost += 550 * 0.85 * b_price_down_num + 550 * b_normal_price_num

                    c_bulk_num = c // 3
                    c_price_down_num = c_bulk_num * 3
                    c_normal_price_num = c - c_price_down_num
                    cost += 850 * 0.88 * c_price_down_num + 850 * c_normal_price_num

                    costs.append(cost)

    print(int(min(costs)))

Python: a=[1e4]*51
for i,j in[(2,380),(3,550),(5,850),(10,1520),(12,1870),(15,2244)]:
 a[i]=j
 for k in range(51-i):
  if a[k+i]>a[k]+j:a[k+i]=a[k]+j
for n in iter(input,'0'):print(a[int(n)//100])

Python: while True:
 N = int(input())
 if N==0: break
 ans = float('inf')
 for c200 in range(N//200+1):
  for c300 in range(N//300+1):
   for c500 in range(N//500+1):
    if 200 * c200 + c300 * 300 + c500 * 500 == N:
     ans = min(ans, 1520*(c200//5)+380*(c200%5)+1870*(c300//4)+550*(c300%4)+2244*(c500//3)+850*(c500%3))
 print(ans)

Python: INF = 10 ** 20

def solve(n):
  ans = INF
  for i in range(n // 500 + 1):
    for j in range((n - 500 * i) // 300 + 1):
      if not (n - 500 * i - 300 * j) % 200:
        a = (n - 500 * i - 300 * j) // 200
        va = a // 5 * 1900 * 0.8  + a % 5 * 380
        vb = j // 4 * 2200 * 0.85 + j % 4 * 550
        vc = i // 3 * 2550 * 0.88 + i % 3 * 850
        ans = min(ans, va + vb + vc)
  print(int(ans))

while True:
  n = int(input())
  if not n:
    break
  solve(n)