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: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106&lang=jp
"""
import sys


def solve(amount):
    """
    :param amount: ?????\???????????°?????????
    :return: ?????????
    """
    best_price = (amount + 199) // 200 * 380
    for a in range(amount // 200 + 1):
        for b in range(amount // 300 + 1):
            for c in range(amount // 500 + 1):
                for a1 in range(amount // 1000 + 1):
                    for b1 in range(amount // 1200 + 1):
                        for c1 in range(amount // 1500 + 1):
                            if a*200 + b*300 + c*500 + a1*1000 + b1*1200 + c1*1500 == amount:
                                price = a*380 + b*550 + c*850 + a1*1520 + b1*1870 + c1*2244
                                if price < best_price:
                                    best_price = price
    return best_price


def solve2(amount):
    """
    ???????¨???????????????¨?????????????????§???
    """
    packages = [(0, 0), (2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)] # 1?¢??????????(100g??????)??¨??????????????¢l
    # dp??¨???2?¬??????????????¨?????????????(100g??????)?????????????????¨??§??????packages????¨????
    # 999999...??????INF??¨?????? (phthon 3.5??\??????????????????math.inf????????¨??§??????)
    cart = [[99999999] * (amount//100 + 1) for _ in range(len(packages))]
    for i in range(len(packages)):
        cart[i][0] = 0          #  0g???????????\????????´??????0???????????????

    for i in range(1, len(packages)):
        for j in range(1, len(cart[0])):
            w = packages[i][0]  #  ??????
            p = packages[i][1]  #  ??????
            if j < w:
                cart[i][j] = cart[i-1][j]
            else:
                # ???????????????????????????????????????????????????????????????????????????????¨????
                cart[i][j] = min(cart[i-1][j], cart[i-1][max(0, j-w)]+p, cart[i][max(0, j-w)]+p)
    return cart[-1][-1]


def main(args):
    while True:
        amount = int(input())
        if amount == 0:
            break
        #result = solve(amount)
        #print(result)
        result = solve2(amount)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: P = [2, 10, 3, 12, 5, 15]
Q = [380, 1520, 550, 1870, 850, 2244]
L = 50
R = [0] + [1e9]*L
for p, q in zip(P, Q):
    for i in range(L-p+1):
        R[i+p] = min(R[i+p], R[i] + q)
while 1:
    v = int(input())
    if v == 0:
        break
    print(R[v//100])

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106&lang=jp
"""
import sys


def solve(amount):
    """
    :param amount: ?????\???????????°?????????
    :return: ?????????
    """
    best_price = (amount + 199) // 200 * 380
    for a in range(amount // 200 + 1):
        for b in range(amount // 300 + 1):
            for c in range(amount // 500 + 1):
                for a1 in range(amount // 1000 + 1):
                    for b1 in range(amount // 1200 + 1):
                        for c1 in range(amount // 1500 + 1):
                            if a*200 + b*300 + c*500 + a1*1000 + b1*1200 + c1*1500 == amount:
                                price = a*380 + b*550 + c*850 + a1*1520 + b1*1870 + c1*2244
                                if price < best_price:
                                    best_price = price
    return best_price




def main(args):
    while True:
        amount = int(input())
        if amount == 0:
            break
        result = solve(amount)
        print(result)



if __name__ == '__main__':
    main(sys.argv[1:])

Python: a=[2,3,5,10,12,15]
b=[380,550,850,1520,1870,2244]
while 1:
    n=int(input())
    if n==0:break
    n//=100
    dp=[0]+[1<<29]*n
    for i in range(5,-1,-1):
        for j in range(n+1):
            if j+a[i]<=n and dp[j]!=1<<29:dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i])
    print(dp[n])

Python: def calc(A, B, C):
    da = A // 5
    na = A % 5
    db = B // 4
    nb = B % 4
    dc = C // 3
    nc = C % 3
    return da*1520 + na*380 + db*1870 + nb*550 + dc*2244 + nc*850

def f(a, b, c, g):
    if g == 0:
        return calc(a, b, c)
    if g < 0:
        return 10000000

    return min(f(a+1, b, c, g-2), f(a, b+1, c, g-3), f(a, b, c+1, g-5))

ans = [0,0,0,0,0,850,1100,1230,1400,1610,1520,\
       1950,1870,2070,2250,2244,2620,2624,2794,3004,3040,\
       3344,3390,3590,3740,3764,4120,4114,4314,4494,4488,\
       4864,4868,5038,5248,5284,5588,5634,5834,5984,6008,\
       6364,6358,6558,6738,6732,7108,7112,7282,7492,7528]

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

Python: import sys
#from me.io import dup_file_stdin

def price(pack,unit_price,units,off):
    return pack//units*units*unit_price*(1.-off) + pack%units*unit_price

#@dup_file_stdin
def solve():
    while True:
        w = int(sys.stdin.readline())
        if w == 0 :return
        min = max([380*25,550*17,850*10])
        for a in range(0,w//200+1):
            need = w - a*200 
            for b in range(0,need//300+1):
                if((need-b*300)%500!=0):continue
                c = (need-b*300)//500
                p = price(a,380,5,0.2)+price(b,550,4,0.15)+price(c,850,3,0.12)
                if p < min:
                    min = p
        print("{:.0f}".format(min))
solve()

Python: h={15:2244,12:1870,10:1520,5:850,3:550,2:380}
m={0:0}

for i in range(50):
  if i in m:
    for k,v in h.items():
      m[i+k] = min(m.get(i+k,1e9),m[i]+v)

while True:
  n = input()
  if n == 0 : break
  print(m[n/100])

Python: while 1:
    try:
        inp=int(input())
        if inp==0:break
        m_list=[]
        for i in range(4):
            for j in range(5):
                for k in range(6):
                    for l in range(3):
                        for m in range(4):
                            for n in range(5):
                                if i*1500+j*1200+k*1000+l*500+m*300+n*200==inp:
                                    m_list.append(i*2244+j*1870+k*1520+l*850+m*550+n*380)
        print(min(m_list))
    except:break