Problem:


Score : 300 points

Problem Statement

You've come to your favorite store Infinitesco to buy some ice tea.

The store sells ice tea in bottles of different volumes at different costs.
Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen.
The store has an infinite supply of bottles of each type.

You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Constraints

1 \leq Q, H, S, D \leq 10^8

1 \leq N \leq 10^9

All input values are integers.

Input

Input is given from Standard Input in the following format:

Q H S D
N

Output

Print the smallest number of yen you have to spend to buy exactly N liters of ice tea.

Sample Input 1

20 30 70 90
3

Sample Output 1

150

Buy one 2-liter bottle and two 0.5-liter bottles. You'll get 3 liters for 90 + 30 + 30 = 150 yen.

Sample Input 2

10000 1000 100 10
1

Sample Output 2

100

Even though a 2-liter bottle costs just 10 yen, you need only 1 liter.
Thus, you have to buy a 1-liter bottle for 100 yen.

Sample Input 3

10 100 1000 10000
1

Sample Output 3

40

Now it's better to buy four 0.25-liter bottles for 10 + 10 + 10 + 10 = 40 yen.

Sample Input 4

12345678 87654321 12345678 87654321
123456789

Sample Output 4

1524157763907942



Sample input:
20 30 70 90
3


Sample output:
150

Submission status: Wrong Answer

Solution code:
Q,H,S,D = list(map(int,input().split()))
N = int(input())

A = S * N

if H*2 < S: A = H*2 * N
if Q*4 < H*2 and Q*4 < S: A = Q*4 * N

if N%2 == 0:
	if D/2 * N < A: A = D/2 * N
else:
	if D/2 < S and D/2 < H*2 and D/2 < Q*4: A = D*((N-1)/2) + A/N

print(int(A))

Submission status: Wrong Answer

Solution code:
q,h,s,d=list(map(int,input().split()))
n = int(input())

ans = int(0)

if d < 2*s and d < 4*h and d < 8*q:
    ans += int(n/2)*d
    n %= 2

if s < 2*h and s < 4*q:
    ans += n*d
elif h < 2*q:
    ans += n*2*h
else:
    ans += n*4*q

print(ans)

Submission status: Wrong Answer

Solution code:
q,h,s,d=map(int,input().split())
n=int(input())
cospa=[[q/0.25,0.25,q],[h/0.5,0.5,h],[s,1.0,s],[d/2,2.0,d]]
cospa.sort()
money=0
for i in range(4):
  if(n>=cospa[i][1]):
    x=n//cospa[i][1]
    money+=x*cospa[i][2]
    n%=cospa[i][1]
print(int(money))

Submission status: Wrong Answer

Solution code:
Q,H,S,D=map(int,input().split())
N=int(input())

Q=4*Q
H=2*H
if N%2==0:
	ans=(N/2)*min(2*Q,2*H,2*S,D)
else:
	ans=(N//2)*min(2*Q,2*H,2*S,D)+(N%2)*min(Q,H,S)

# ans=(N//2)*min(2*Q,2*H,2*S,D)+(N%2)*min(Q,H,S)

print(ans)

Submission status: Wrong Answer

Solution code:
Q,H,S,D=map(int,input().split())
N=int(input())

Q=4*Q
H=2*H
if N%2==0:
	ans=(N/2)*min(2*Q,2*H,2*S,D)
else:
	ans=(N//2)*min(2*Q,2*H,2*S,D)+1*min(Q,H,S)

# ans=(N//2)*min(2*Q,2*H,2*S,D)+(N%2)*min(Q,H,S)

print(ans)

Submission status: Wrong Answer

Solution code:
Q,H,S,D=map(int,input().split())
N=int(input())

Q=4*Q
H=2*H
if N%2==0:
	ans=(N/2)*min(2*Q,2*H,2*S,D)
else:
	ans=(N//2)*min(2*Q,2*H,2*S,D)+min(Q,H,S)

print(ans)

Submission status: Wrong Answer

Solution code:
Q,H,S,D=map(int,input().split())
N=int(input())

Q=4*Q
H=2*H
if N==1:
	ans=min(Q,H,S)
elif N%2==0:
	ans=(N/2)*min(2*Q,2*H,2*S,D)
else:
	ans=(N//2)*min(2*Q,2*H,2*S,D)+min(Q,H,S)
	
print(ans)

Submission status: Wrong Answer

Solution code:
Q,H,S,D=map(int,input().split())
N=int(input())

Q=4*Q
H=2*H
if N==1:
	ans=min(Q,H,S)
elif N%2==0:
	ans=(N/2)*min(2*Q,2*H,2*S,D)
else:
	ans=int(N/2)*min(2*Q,2*H,2*S,D)+min(Q,H,S)
	
print(ans)

Submission status: Wrong Answer

Solution code:
b=list(map(int,input().split()))
c = int(input())
ans = 0
r = min([b[0]*4, b[1]*2, b[2]])
r2 = min([r*2, b[3]])
#if c % 2 == 1:
#    ans += r
#   c -= 1
#ans += r2 * (c / 2)
#print(int(ans))

if c%2==1:
	print(int(((c-1)/2)*r2+r))
else :
	print(int((c/2)*r2))

Submission status: Wrong Answer

Solution code:
b=list(map(int,input().split()))
c = int(input())
ans = 0
r = min([b[0]*4, b[1]*2, b[2]])
r2 = min([r*2, b[3]])
#if c % 2 == 1:
#    ans += r
#   c -= 1
#ans += r2 * (c / 2)
#print(int(ans))

if c%2==1:
	print(((c-1)/2)*r2+r)
else :
	print((c/2)*r2)

Submission status: Wrong Answer

Solution code:
b=list(map(int,input().split()))
c = int(input())
ans = 0
r = min([b[0] * 4, b[1] * 2, b[2]])
r2 = min([b[0]*8,b[1]*4,b[2]*2, b[3]])
if c % 2 == 1:
    ans += r
    c -= 1
ans += r2 * (c / 2)
print(int(ans))

Submission status: Wrong Answer

Solution code:
a = input().split(" ")
b = list(map(int, a))
c = int(input())
ans = 0
r = min([b[0] * 4, b[1] * 2, b[2]])
r2 = min([b[0]*8,b[1]*4,b[2]*2, b[3]])
#if c % 2 == 1:
#    ans += r
#    c -= 1
#ans += r2 * (c / 2)
if c%2==1:
	ans=r+((c-1)/2)*r2
else :
	ans=c//2*r2
print(int(ans))

Submission status: Wrong Answer

Solution code:
a = input().split(" ")
b = list(map(int, a))
c = int(input())
ans = 0
r = min([b[0] * 4, b[1] * 2, b[2]])
r2 = min([b[0]*8,b[1]*4,b[2]*2, b[3]])
if c % 2 == 1:
    ans += r
    c -= 1
ans += r2 * (c / 2)
print(int(ans))

Submission status: Wrong Answer

Solution code:
a = input().split(" ")
b = list(map(int, a))
c = int(input())
ans = 0
r = min([b[0] * 4, b[1] * 2, b[2]])
r2 = min([r * 2, b[3]])
if c % 2 == 1:
    ans += r
    c -= 1
ans += r2 * (c / 2)
print(int(ans))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q*4,h*2,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
if a[0][2]<2:
  k = n * a[0][0]
else:
  k=  (n // 2) * a[0][1] + a[1][0]
  
print(round(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q*4,h*2,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
if a[0][2]<2:
  k = n / a[0][2] * a[0][1]
else:
  k=  n // 2 * a[0][1] + (n % 2) / a[1][2] * a[1][1]
  
print(round(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q*4,h*2,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
if a[0][2]<2:
  k = n // a[0][2] * a[0][1]
else:
  k=  n // 2 * a[0][1] + (n % 2) // a[1][2] * a[1][1]
  
print(round(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q*4,h*2,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
while n > 0:
  if a[0][2]<2:
    k += n // a[0][2] * a[0][1]
    n = 0
  elif n>=a[0][2] and n // a[0][2] * a[0][1]>0:
    k += n // a[0][2] * a[0][1]
    n = n % a[0][2]
  del a[0]
print(round(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q*4,h*2,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
while n > 0:
  
  if n>=a[0][2] and n // a[0][2] * a[0][1]>0:
    k += n // a[0][2] * a[0][1]
    n = n % a[0][2]
  del a[0]
print(round(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q/0.25,h/0.5,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()

k=0
while n > 0:
  
  if n>=a[0][2] and n // a[0][2] * a[0][1]>0:
    k += n // a[0][2] * a[0][1]
    n = n % a[0][2]
  del a[0]
print(round(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q/0.25,h/0.5,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
while n > 0:
  if n>=a[0][2] and n // a[0][2] * a[0][1]>0:
    k += n // a[0][2] * a[0][1]
    n = n % a[0][2]
  del a[0]
print(int(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q/0.25,h/0.5,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
while n > 0:
  if n // a[0][2] * a[0][1]>0:
    k += n // a[0][2] * a[0][1]
    n = n % a[0][2]
  del a[0]
print(int(k))

Submission status: Wrong Answer

Solution code:
q,h,s,d=[int(i) for i in input().split()]
n=int(input())

qr,hr,sr,dr=q/0.25,h/0.5,s,d/2
a=[[qr,q,0.25],[hr,h,0.5],[sr,s,1],[dr,d,2]]

a.sort()
k=0
while n > 0:
  k += n // a[0][2] * a[0][1]
  n = n % a[0][2]
  del a[0]
print(int(k))

Submission status: Wrong Answer

Solution code:
Q, H, S, D = map(int,input().split())
N = int(input())
ans = 0
price1 = Q * 4
price2 = H * 2
price3 = S
price4 = D / 2
price_list = [price1, price2, price3]
price_list2 = [price1, price2, price3, price4]
if N == 1:
    ans = min(price_list)
elif N % 2 == 0:
    ans = min(price_list2) * N
else:
    if min(price_list2) == price4:
        ans = price4 * (N-1) + min(price_list)
    else:
        ans = min(price_list2) * N
print(int(ans))

Submission status: Wrong Answer

Solution code:
Q, H, S, D = map(int,input().split())
N = int(input())
ans = 0
price1 = int(Q * 4)
price2 = int(H * 2)
price3 = int(S)
price4 = D / 2
price_list = [price1, price2, price3]
price_list2 = [price1, price2, price3, price4]
if N == 1:
    ans = min(price_list)
elif N % 2 == 0:
    ans = int(min(price_list2) * N)
else:
    if min(price_list2) == price4:
        ans = int(price4 * 2) * (N-1) / 2 + min(price_list)
    else:
        ans = int(min(price_list2) * N)
print(int(ans))

Submission status: Wrong Answer

Solution code:
def main():
    rt = 0
    Q,H,S,D = map(int,input().split(" "))
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1*2)//1
    count_3 = (N-count_1*2-count_2)*100//50
    count_4 = (((N-count_1*2-count_2)*100)-50*count_3)//25
    if count_1:
        rt+=count_1*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=count_2*min(S,2*H,4*Q)
    if count_3:
        rt+=min(H,2*Q)*count_3
    if count_4:
        rt+=Q*count_4
    print(int(rt))

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    rt = 0
    Q,H,S,D = map(int,input().split(" "))
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1*2)//1
    count_3 = (N-count_1*2-count_2)*100//50
    count_4 = (((N-count_1*2-count_2)*100)-50*count_3)//25
    if count_1:
        rt+=count_1*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=count_2*min(S,2*H,4*Q)
    if count_3:
        rt+=min(2*H,Q)*count_3
    if count_4:
        rt+=Q*count_4
    print(int(rt))

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    rt = 0
    Q,H,S,D = map(int,input().split(" "))
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1*2)//1
    count_3 = (N-count_1*2-count_2)*100//50
    count_4 = (((N-count_1*2-count_2)*100)-50*count_3)//25
    if count_1:
        rt+=count_1*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=count_2*min(S,2*H,4*Q)
    if count_3:
        rt+=min(2*H,Q)*count_3
    if count_4:
        rt+=Q*count_4
    print(rt)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    rt = 0
    Q,H,S,D = map(int,input().split(" "))
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1)//1
    count_3 = (N-count_1-count_2)*100//50
    count_4 = (((N-count_1-count_2)*100)-50*count_3)//25
    if count_1:
       rt+=count_1*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=count_2*min(S,2*H,4*Q)
    if count_3:
        rt+=min(2*H,Q)*count_3
    if count_4:
        rt+=Q*count_4
    print(rt)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
Q, H, S, D = map(int, input().split())
N = int(input())

data = [Q*4, H*2, S, D/2]
nums = [0.25, 0.5, 1, 2]
price = [Q, H, S, D]
data_index = sorted(range(len(data)), key=lambda k: data[k])
#print(data,data_index)
ans = 0
for i in range(4):
    ans += N//nums[data_index[i]] * price[data_index[i]]
    N -= N//nums[data_index[i]] * nums[data_index[i]]
print(int(ans))

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int, input().split())
n = int(input())

s = min(q*4, h*2, s)

print(s*n if d>s*2 else d*(n//2)+s)

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int, input().split())
n = int(input())

s = min(q*4, h*2, s)

print(s*n if d<s*2 else d*(n//2)+s)

Submission status: Wrong Answer

Solution code:
m = list(map(int,input().split()))
n = int(input())


m[0] *= 4
m[1] *= 2
m[2] *= 1
m[3] /= 2

x = min(m)
ans = x * n
if x == m[3] and n%2 == 1:
    ans += -m[3] + min(m[:3])

print(int(ans))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
# values = np.array([min(2*min(2*Q, H), S), D])
# # 評価値
# capacities = np.array([1.0, 2.0])
# eval = values / capacities
N = int(input())
# nums = np.zeros(2)
#
# sorted_eval_index = np.argsort(eval)
#
# # N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n
#
# for index in list(sorted_eval_index):
#     if N/capacities[index] >= 1:
#         nums[index] += int(N/capacities[index])
#         N -= nums[index] * capacities[index]
#
# print(int(np.sum(values*nums)))

print(int(N/2*(min(2*min(2*min(2*Q, H), S), D))+(N % 2)*(min(2*min(2*Q, H), S))))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
# values = np.array([min(2*min(2*Q, H), S), D])
# # 評価値
# capacities = np.array([1.0, 2.0])
# eval = values / capacities
N = int(input())
# nums = np.zeros(2)
# 
# sorted_eval_index = np.argsort(eval)
# 
# # N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n
# 
# for index in list(sorted_eval_index):
#     if N/capacities[index] >= 1:
#         nums[index] += int(N/capacities[index])
#         N -= nums[index] * capacities[index]
# 
# print(int(np.sum(values*nums)))

print(N/2*(min(2*min(2*min(2*Q, H), S), D))+(N % 2)*(min(2*min(2*Q, H), S)))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([min(2*min(2*Q, H), S), D])
# 評価値
capacities = np.array([1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(2)

sorted_eval_index = np.argsort(eval)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(int(np.sum(values*nums)))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([min(min(2*Q, H), S), D])
# 評価値
capacities = np.array([1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(2)

sorted_eval_index = np.argsort(eval)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(int(np.sum(values*nums)))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([min(min(2*Q, H), S), D])
# 評価値
capacities = np.array([1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(2)

sorted_eval_index = np.argsort(eval)

print(capacities)
print(values)
print(sorted_eval_index)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(int(np.sum(values*nums)))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([Q, H, S, D])
# 評価値
capacities = np.array([0.25, 0.5, 1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(4)

sorted_eval_index = np.argsort(eval)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

N_last = N

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(int(np.sum(values*nums)))

Submission status: Wrong Answer

Solution code:
import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([Q, H, S, D])
# 評価値
capacities = np.array([0.25, 0.5, 1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(4)

sorted_eval_index = np.argsort(eval)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

N_last = N

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(np.sum(values*nums))

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int, raw_input().split())
n = int(raw_input())

price_dic = {
0.25: q,
0.5: h,
1: s,
2:d}

ippl = {}
for k,v in price_dic.items():
    ippl[v / float(k)] = k

bottles = {}
cost = 0
for k in sorted(ippl.keys()):
    if n < 0:
        break
    vol = ippl[k]
    if n % vol == 0:
        q = n / vol
        cost += q * price_dic[ippl[k]]
        # print 'd', n, vol, price_dic[ippl[k]], cost, q
        n -= q*vol
    else:
        q = n // vol
        cost += q * price_dic[ippl[k]]
        # print 'nd', n, vol, price_dic[ippl[k]], cost, q
        n -= q*vol

print int(cost)

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int, raw_input().split())
n = int(raw_input())

price_dic = {
0.25: q,
0.5: h,
1: s,
2:d}

ippl = {}
for k,v in price_dic.items():
    ippl[v / float(k)] = k

bottles = {}
cost = 0
for k in sorted(ippl.keys()):
    if n < 0:
        break
    vol = ippl[k]
    if n % vol == 0:
        q = n / vol
        cost += q * price_dic[ippl[k]]
        # print 'd', n, vol, price_dic[ippl[k]], cost, q
        n -= q*vol
    else:
        q = n // vol
        cost += q * price_dic[ippl[k]]
        # print 'nd', n, vol, price_dic[ippl[k]], cost, q
        n -= q*vol

print cost

Submission status: Wrong Answer

Solution code:
q=input()
print(q)

Submission status: Wrong Answer

Solution code:
Value = list(map(int,input().split()))
#Value[0] = Q,Value[1] = H,Value[2] = S…
N = int(input())
res = 0
l = [0.25,0.5,1,2]

for i in range(3):
    if Value[i]*2 < Value[i+1]:
        Value[i+1] = Value[i]*2

for i in range(4)[::-1]:
    n = N//l[i]
    N = N%l[i]
    res += Value[i]*n

print(int(res))

Submission status: Wrong Answer

Solution code:
Value = list(map(int,input().split()))
#Value[0] = Q,Value[1] = H,Value[2] = S…
N = int(input())
res = 0

for i in range(3):
    if Value[i]*2 < Value[i+1]:
        Value[i+1] = Value[i]*2

j = 3
for i in [2, 1, 0.50, 0.25]:
    n = N//i
    N = N%i
    res += Value[j]*n
    j -= 1


print(int(res))

Submission status: Wrong Answer

Solution code:
#get parameters
Qc, Hc, Sc, Dc = map(int, input().split())
Nv = int(input())
Nc = 0
# creat lists
Volumes = [0.25,0.50,1.00,2.00]
Costs = [Qc, Hc, Sc, Dc]
V_ = Nv
Number_bottles = [0,0,0,0]
costpervolume = []

for i in range(len(Volumes)):
    costpervolume.append(Costs[i] / Volumes[i])
#print (costpervolume)
for i in range(len(Volumes)):
    min_ = min(costpervolume)
    #print (min_)
    i_ = costpervolume.index(min(costpervolume))
    costpervolume[i_] = 1e8 + 1
    #print(costpervolume)
    Number_bottles[i_] = V_//Volumes[i_]
    V_ -= Volumes[i_] * Number_bottles[i_]
    
    #print(V_)
    if V_ == 0:
        break

for i in range(len(Volumes)):
	
	Nc +=  Number_bottles[i] * Costs[i]

print (int(Nc))

Submission status: Wrong Answer

Solution code:
#get parameters
Qc, Hc, Sc, Dc = map(int, input().split())
Nv = int(input())
Nc = 0
# creat lists
Volumes = [0.25,0.50,1.00,2.00]
Costs = [Qc, Hc, Sc, Dc]
V_ = Nv
Number_bottles = [0,0,0,0]
costpervolume = []

for i in range(len(Volumes)):
    costpervolume.append(Costs[i] / Volumes[i])
print (costpervolume)
for i in range(len(Volumes)):
    min_ = min(costpervolume)
    #print (min_)
    i_ = costpervolume.index(min(costpervolume))
    costpervolume[i_] = 1e8 + 1
    #print(costpervolume)
    Number_bottles[i_] = V_//Volumes[i_]
    V_ -= Volumes[i_] * Number_bottles[i_]
    
    #print(V_)
    if V_ == 0:
        break

for i in range(len(Volumes)):
	
	Nc +=  Number_bottles[i] * Costs[i]

print (int(Nc))

Submission status: Wrong Answer

Solution code:
#get parameters
Qc, Hc, Sc, Dc = map(int, input().split())
Nv = int(input())
Nc = 0
# creat lists
Volumes = [0.25,0.50,1.00,2.00]
Costs = [Qc, Hc, Sc, Dc]
V_ = Nv
Number_bottles = [0,0,0,0]
costpervolume = []

for i in range(len(Volumes)):
    costpervolume.append(Costs[i] / Volumes[i])
print (costpervolume)
for i in range(len(Volumes)):
    min_ = min(costpervolume)
    #print (min_)
    i_ = costpervolume.index(min(costpervolume))
    costpervolume[i_] = 1e8 + 1
    #print(costpervolume)
    Number_bottles[i_] = V_//Volumes[i_]
    V_ -= Volumes[i_] * Number_bottles[i_]
    
    #print(V_)
    if V_ == 0:
        break

for i in range(len(Volumes)):
	
	Nc +=  Number_bottles[i] * Costs[i]

print (Nc)

Submission status: Wrong Answer

Solution code:
#get parameters
Qc, Hc, Sc, Dc = map(int, input().split())
Nv = input()
Nc = 0
# creat lists
Volumes = [0.25,0.50,1.00,2.00]
Costs = [Qc, Hc, Sc, Dc]
V_ = Nv
Number_bottles = [0,0,0,0]

for i in range(0,len(Volumes),-1):

	Number_bottles[i] = V_//Volumes[i]
	V_ = Volumes[i] * Number_bottles[i]

for i in range(len(Volumes)):
	
	Nc +=  Number_bottles[i] * Costs[i]

print (Nc)

Submission status: Wrong Answer

Solution code:
import math 

if __name__ == '__main__':
    Q, H, S, D = map(int, input().split())
    N = int(input())
    q, h ,s ,d = [0.25, 0.5, 1, 2]
    cost_d1 = 0
    cost_d2 = 0
    cost_d3 = 0
    cost_d4 = 0
    cost_s1 = 0
    cost_s2 = 0
    cost_h = 0
    cost_q = 0
    if N > d:
        #DSHQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d1 += idd*D
        ids = int(N_d/s)
        if ids > 0:
            N_d -= ids*s
            cost_d1 += ids*S
        idh = int(N_d/h)
        if idh > 0:
            N_d -= idh*h
            cost_d1 += idh*H
        idq = int(N_d/q)
        cost_d1 += idq*Q
        #DSQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d2 += idd*D
        ids = int(N_d/s)
        if ids > 0:
            N_d -= ids*s
            cost_d2 += ids*S
        idq = int(N_d/q)
        cost_d2 += idq*Q
        #DHQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d3 += idd*D
        idh = int(N_d/h)
        if idh > 0:
            N_d -= idh*h
            cost_d3 += idh*H
        idq = int(N_d/q)
        cost_d3 += idq*Q
        #DQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d4 += idd*D
        idq = int(N_d/q)
        cost_d4 += idq*Q
    else:
        cost_d1 = float('inf')
        cost_d2 = float('inf')
        cost_d3 = float('inf')
        cost_d4 = float('inf')
    if N > s:
        #SHQ
        N_s = N
        iss = int(N_s/s)
        if iss>0:
            N_s -= iss*s
            cost_s1 += iss*S
        ish = int(N_s/h)
        if ish > 0:
            N_s -= ish*h
            cost_s1 += ish*H
        isq = int(N_s/q)
        cost_s1 += isq*Q
        #SQ
        N_s = N
        iss = int(N_s/s)
        if iss > 0:
            N_s -= iss*s
            cost_s2 += iss*S
        isq = int(N_s/q)
        cost_s2 += isq*Q
    else:
        cost_s1 = float('inf')
        cost_s1 = float('inf')
    if N > h:
        #HQ
        N_h = N 
        ihh = int(N_h/h)
        if ihh > 0:
            N_h -= ihh*h
            cost_h += ihh*H
        ihq = int(N_h/q)
        cost_h += ihq*Q
    else:
        cost_h = float('inf')
    #Q
    N_q = N
    iqq = int(N_q/q)
    cost_q += iqq*Q
    
    ans = min(cost_d1, cost_d2, cost_d3, cost_d4, cost_s1, cost_s2, cost_h, cost_q)
    print(ans)

Submission status: Wrong Answer

Solution code:
import math 

if __name__ == '__main__':
    Q, H, S, D = map(int, input().split())
    N = int(input())
    q, h ,s ,d = [0.25, 0.5, 1, 2]
    cost_d1 = 0
    cost_d2 = 0
    cost_d3 = 0
    cost_d4 = 0
    cost_s1 = 0
    cost_s2 = 0
    cost_h = 0
    cost_q = 0
    if N > d:
        #DSHQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d1 += idd*D
        ids = int(N_d/s)
        if ids > 0:
            N_d -= ids*s
            cost_d1 += ids*S
        idh = int(N_d/h)
        if idh > 0:
            N_d -= idh*h
            cost_d1 += idh*H
        idq = int(N_d/q)
        N_d -= idq*q
        cost_d1 += idq*Q
        #DSQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d2 += idd*D
        ids = int(N_d/s)
        if ids > 0:
            N_d -= ids*s
            cost_d2 += ids*S
        idq = int(N_d/q)
        N_d -= idq*q
        cost_d2 += idq*Q
        #DHQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d3 += idd*D
        idh = int(N_d/h)
        if idh > 0:
            N_d -= idh*h
            cost_d3 += idh*H
        idq = int(N_d/q)
        N_d -= idq*q
        cost_d3 += idq*Q
        #DQ
        N_d = N
        idd = int(N_d/d)
        if idd > 0:
            N_d -= idd*d
            cost_d4 += idd*D
        idq = int(N_d/q)
        N_d -= idq*q
        cost_d4 += idq*Q
    else:
        cost_d1 = float('inf')
        cost_d2 = float('inf')
        cost_d3 = float('inf')
        cost_d4 = float('inf')
    if N > s:
        #SHQ
        N_s = N
        iss = int(N_s/s)
        if iss>0:
            N_s -= iss*s
            cost_s1 += iss*S
        ish = int(N_s/h)
        if ish > 0:
            N_s -= ish*h
            cost_s1 += ish*H
        isq = int(N_s/q)
        N_s -= isq*q
        cost_s1 += isq*Q
        #SQ
        N_s = N
        iss = int(N_s/s)
        if iss > 0:
            N_s -= iss*s
            cost_s2 += iss*S
        isq = int(N_s/q)
        N_s -= isq*q
        cost_s2 += isq*Q
    else:
        cost_s1 = float('inf')
        cost_s1 = float('inf')
    if N > h:
        #HQ
        N_h = N 
        ihh = int(N_h/h)
        if ihh > 0:
            N_h -= ihh*h
            cost_h += ihh*H
        ihq = int(N_h/q)
        N_h -= ihq*q
        cost_h += ihq*Q
    else:
        cost_h = float('inf')
    #Q
    N_q = N
    iqq = int(N_q/q)
    N_q -= iqq*q
    cost_q += iqq*Q
    ans = min(cost_d1, cost_d2, cost_d3, cost_d4, cost_s1, cost_s2, cost_h, cost_q)
    print(ans)

Submission status: Wrong Answer

Solution code:
import math 

if __name__ == '__main__':
    Q, H, S, D = map(int, input().split())
    N = int(input())
    q, h ,s ,d = [0.25, 0.5, 1, 2]
    cost_d1 = 0
    cost_d2 = 0
    cost_d3 = 0
    cost_d4 = 0
    cost_s1 = 0
    cost_s2 = 0
    cost_h = 0
    cost_q = 0
    if N > d:
        #DSHQ
        N_d = N
        while N_d >= d:
            N_d -= d
            cost_d1 += D
        while N_d >= s:
            N_d -= s
            cost_d1 += S
        while N_d >= h:
            N_d -= h
            cost_d1 += H
        while N_d  > 0:
            N_d -= q
            cost_d1 += Q
        #DSQ
        N_d = N
        while N_d >= d:
            N_d -= d
            cost_d2 += D
        while N_d >= s:
            N_d -= s
            cost_d2 += S
        while N_d  > 0:
            N_d -= q
            cost_d2 += Q
        #DHQ
        N_d = N
        while N_d >= d:
            N_d -= d
            cost_d3 += D
        while N_d >= h:
            N_d -= h
            cost_d3 += H
        while N_d  > 0:
            N_d -= q
            cost_d3 += Q
        #DQ
        N_d = N
        while N_d >= d:
            N_d -= d
            cost_d4 += D
        while N_d  > 0:
            N_d -= q
            cost_d4 += Q
    else:
        cost_d1 = float('inf')
        cost_d2 = float('inf')
        cost_d3 = float('inf')
        cost_d4 = float('inf')
    if N > s:
        #SHQ
        N_s = N
        while N_s >= s:
            N_s -= s
            cost_s1 += S
        while N_s >= h:
            N_s -= h
            cost_s1 += H
        while N_s > 0:
            N_s -= q
            cost_s1 += Q
        #SQ
        N_s = N
        while N_s >= s:
            N_s -= s
            cost_s2 += S
        while N_s > 0:
            N_s -= q
            cost_s2 += Q
    else:
        cost_s1 = float('inf')
        cost_s1 = float('inf')
    if N > h:
        #HQ
        N_h = N 
        while N_h >= h:
            N_h -= h
            cost_h += H
        while N_h > 0:
            N_h -= q
            cost_h += Q
    else:
        cost_h = float('inf')
    #Q
    N_q = N
    while N_q > 0:
        N_q -= q
        cost_q += Q
    ans = min(cost_d1, cost_d2, cost_d3, cost_d4, cost_s1, cost_s2, cost_h, cost_q)
    print(ans)

Submission status: Wrong Answer

Solution code:
import math 

if __name__ == '__main__':
    Q, H, S, D = map(int, input().split())
    N = int(input())
    q, h ,s ,d = [0.25, 0.5, 1, 2]
    cost_d = float('inf')
    cost_s = float('inf')
    cost_h = float('inf')
    cost_q = float('inf')
    if N > d:
        N_d=N
        while N_d > d:
            N_d -= d
            cost_d += D
        while N_d > s:
            N_d -= s
            cost_d += S
        while N_d > h:
            N_d -= h
            cost_d += H
        while N_d  > 0:
            N_d -= q
            cost_d += Q
    elif N > s:
        N_s = N
        while N_s > s:
            N_s -= s
            cost_s += S
        while N_s > h:
            N_s -= h
            cost_s += H
        while N_s > 0:
            N_s -= q
            cost_s += Q
    elif N > h:
        N_h = N 
        while N_h > h:
            N_h -= h
            cost_h += H
        while N_h > 0:
            N_h -= q
            cost_h += Q
    else:
        N_q = N
        while N_q > 0:
            N_q -= q
            cost_q += Q
    ans = min(cost_d, cost_s, cost_h, cost_q)
    print(ans)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    Q, H, S, D = map(int, input().split())
    N = int(input())
    q, h ,s ,d = [0.25, 0.5, 1, 2]
    cost_d = 0
    cost_s = 0
    cost_h = 0
    cost_q = 0
    if N > d:
        N_d=N
        while N_d > d:
            N_d -= d
            cost_d += D
        while N_d > s:
            N_d -= s
            cost_d += S
        while N_d > h:
            N_d -= h
            cost_d += H
        while N_d  > 0:
            N_d -= q
            cost_d += Q
    elif N > s:
        N_s = N
        while N_s > s:
            N_s -= s
            cost_s += S
        while N_s > h:
            N_s -= h
            cost_s += H
        while N_s > 0:
            N_s -= q
            cost_s += Q
    elif N > h:
        N_h = N 
        while N_h > h:
            N_h -= h
            cost_h += H
        while N_h > 0:
            N_h -= q
            cost_h += Q
    else:
        N_q = N
        while N_q > 0:
            N_q -= q
            cost_q += Q
    ans = min(cost_d, cost_s, cost_h, cost_q)
    print(ans)

Submission status: Wrong Answer

Solution code:
A = input("")
num = 1
for i in range(len(A)-1):
	num += len(A[i+1:].replace(A[i],''))
print(num)

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int,input().split())
n = int(input())

ans = min(4 * q * n, 2 * h * n, s * n)
ans = min(ans, d * (n // 2) + min(s * (n % 2), h * 2 * (n % 2)))
print(ans)

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int, input().split())
n = int(input())
rate = {0.25:q/0.25, 0.5:h/0.5, 1:s, 2:d/2.0}
rate = sorted(rate.items(), key=lambda x:x[1])
if rate[0][0] == 2 :
    ans = n//2 * d
    ans += n%2 * rate[1][1] 
else :
    ans = n * rate[0][1]

print(int(ans))

Submission status: Wrong Answer

Solution code:
q, h, s, d = map(int, input().split())
n = int(input())
rate = {0.25:q/0.25, 0.5:h/0.5, 1:s, 2:d/2.0}
rate = sorted(rate.items(), key=lambda x:x[1])
ans = 0
if rate[0][0] == 2 :
    ans = int(n/2) * d
    ans += n%2 * rate[1][1] 
else :
    ans = n * rate[0][1]

print(int(ans))