Problem:


Score : 300 points

Problem Statement

Snuke is making sugar water in a beaker.
Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.

Operation 1: Pour 100A grams of water into the beaker.

Operation 2: Pour 100B grams of water into the beaker.

Operation 3: Put C grams of sugar into the beaker.

Operation 4: Put D grams of sugar into the beaker.

In our experimental environment, E grams of sugar can dissolve into 100 grams of water.

Snuke will make sugar water with the highest possible density.

The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.
Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.
If there is more than one candidate, any of them will be accepted.

We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent.
Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.

Constraints

1 \leq A < B \leq 30

1 \leq C < D \leq 30

1 \leq E \leq 100

100A \leq F \leq 3 000

A, B, C, D, E and F are all integers.

Inputs

Input is given from Standard Input in the following format:

A B C D E F

Outputs

Print two integers separated by a space.
The first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.

Sample Input 1

1 2 10 20 15 200

Sample Output 1

110 10

In this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.

We can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.
It is not possible to make sugar water with higher density.
For example, the following sequences of operations are infeasible:

If we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.

If we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.

Sample Input 2

1 2 1 2 100 1000

Sample Output 2

200 100

There are other acceptable outputs, such as:

400 200

However, the output below is not acceptable:

300 150

This is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.

Sample Input 3

17 19 22 26 55 2802

Sample Output 3

2634 934



Sample input:
1 2 10 20 15 200


Sample output:
110 10

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f= (int(i) for i in input().split()) 

waterlist=[]
for i in range(0,f+100*a,100*a):
  for j in range(0,f+100*b,100*b):
    if i+j <=f:
      waterlist+=[i+j]
waterlist=list(set(waterlist))
#print(x)

sugarlist=[]
for i in range(int(f/c)+1):
  for j in range(int(f/d)+1):
    if c*i+d*j <=f:
      sugarlist+=[c*i+d*j]
sugarlist=list(set(sugarlist))
#print(y)

density=0
ans1=100
ans2=0
for i in range(len(waterlist)):
  for j in range(len(sugarlist)):
    if 0 < waterlist[i]+sugarlist[j] <= f and sugarlist[j]<=waterlist[i]/100*e:
      tmp=sugarlist[j]/(waterlist[i]+sugarlist[j])
      if density < tmp:
        density = tmp
        ans1=waterlist[i]+sugarlist[j]
        ans2=sugarlist[j]
        
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f= (int(i) for i in input().split()) 

waterlist=[]
for i in range(0,f+100*a,100*a):
  for j in range(0,f+100*b,100*b):
    if i+j <=f:
      waterlist+=[i+j]
waterlist=list(set(waterlist))
#print(x)

sugarlist=[]
for i in range(int(f/c)+1):
  for j in range(int(f/d)+1):
    if c*i+d*j <=f:
      sugarlist+=[c*i+d*j]
sugarlist=list(set(sugarlist))
#print(y)

density=0
ans1=101
ans2=1
for i in range(len(waterlist)):
  for j in range(len(sugarlist)):
    if 0 < waterlist[i]+sugarlist[j] <= f and sugarlist[j]<=waterlist[i]/100*e:
      tmp=sugarlist[j]/(waterlist[i]+sugarlist[j])
      if density < tmp:
        density = tmp
        ans1=waterlist[i]+sugarlist[j]
        ans2=sugarlist[j]
        
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
def concentration(a, b):
    return 100 * b / (a + b)


def main():
    a, b, c, d, e, f = map(int, input().split())
    res = (100 * a, 0)
    con_max = 0
    for w_a in range(0, f + 1, 100 * a):
        for w_b in range(0, f + 1 - w_a, 100 * b):
            w = w_a + w_b
            if w == 0:
                continue

            for s_c in range(0, f + 1 - w, c):
                s_d = min(f - w - s_c, w // 100 * e - s_c) // d * d
                s = s_c + s_d
                con = concentration(w, s)
                if con > con_max:
                    con_max = con
                    res = (w + s, s)

    print(res[0], res[1])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())

water_cand = []
for i in range(F):
    for j in range(F):
        tmp = 100 * A * i + 100 * B * j
        if tmp > F:
            break
        water_cand.append(tmp)

ws_cand = []
for x in water_cand:
    for i in range(F-x+1):
        for j in range(F-x+1):
            tmp = C * i + D * j
            if x + tmp == 0:
                ws_cand.append((x, tmp))
                continue
            if x + tmp < F and (tmp / (x+tmp)) <= (E / (100+E)):
                ws_cand.append((x, tmp))
            else:
                break
if len(ws_cand) == 1 and ws_cand[0] == (0, 0):
    print(0, 0)
    exit()
ws_cand.remove((0, 0))
ans = max(ws_cand, key=lambda x: x[1] / (x[0]+x[1]))
print(ans[0]+ans[1], ans[1])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())

water_cand = []
for i in range(F):
    for j in range(F):
        tmp = 100 * A * i + 100 * B * j
        if tmp > F:
            break
        water_cand.append(tmp)

ws_cand = []
for x in water_cand:
    for i in range(F-x+1):
        for j in range(F-x+1):
            tmp = C * i + D * j
            if x + tmp == 0:
                ws_cand.append((x, tmp))
                continue
            if x + tmp < F and (tmp / (x+tmp)) <= (E / (100+E)):
                ws_cand.append((x, tmp))
            else:
                break
if len(ws_cand) > 1:
    ws_cand.remove((0, 0))
ans = max(ws_cand, key=lambda x: x[1] / (x[0]+x[1]))
print(ans[0]+ans[1], ans[1])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())

water_cand = []
for i in range(F):
    for j in range(F):
        tmp = 100 * A * i + 100 * B * j
        if tmp > F:
            break
        water_cand.append(tmp)

ws_cand = []
for x in water_cand:
    for i in range(F-x+1):
        for j in range(F-x+1):
            tmp = C * i + D * j
            if x + tmp == 0:
                continue
            if x + tmp < F and (tmp / (x+tmp)) <= (E / (100+E)):
                ws_cand.append((x, tmp))
            else:
                break
ws_cand.sort(key=lambda x: x[1] / (x[0]+x[1]), reverse=True)
ans = ws_cand[0]
print(ans[0]+ans[1], ans[1])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = [int(i) for i in input().split()]
waterA = [a * 100 * i for i in range(int(f / (100 * a)) + 1)]
waterB = [b * 100 * i for i in range(int(f / (100 * b)) + 1)]
sugarC = [c * i for i in range(int(f / c) + 1)]
sugarD = [d * i for i in range(int(f / d) + 1)]

# まず水が何100gにできるかを算出(<F)
_water = []
for i in range(int(f / (100 * a)) + 1):
    for j in range(int(f / (100 * b)) + 1):
        if 100 * a * i + 100 * b * j <= f:
            _water.append(100 * a * i + 100 * b * j)
_water = sorted(_water)[1:]
water = [_water[0]]
for i in range(1, len(_water)):
    if _water[i] != _water[i - 1]:
        water.append(_water[i])
# 砂糖が何gにできるかを算出(<F)
_sugar = []
for i in range(int(f / c) + 1):
    for j in range(int(f / d) + 1):
        if c * i + d * j <= f:
            _sugar.append(c * i + d * j)
_sugar = sorted(_sugar)[1:]
sugar = [_sugar[0]]
for i in range(1, len(_sugar)):
    if _sugar[i] != _sugar[i - 1]:
        sugar.append(_sugar[i])
# print(water)
# print(sugar)
# 各場合で砂糖の最大量を計算
maxSugar = [-1, -1, -1]  # [dense, sugar, total]
for i in range(len(sugar)):
    for j in range(len(water)):
        if sugar[i] + water[j] > f:
            continue
        elif maxSugar[0] < sugar[i]/(sugar[i]+water[j]) <= e/(100+e):
            maxSugar[0] = sugar[i]/(sugar[i]+water[j])
            maxSugar[1] = sugar[i]
            maxSugar[2] = sugar[i] + water[j]
        # print("s:{} w:{} dense:{}".format(sugar[i], water[j], sugar[i]/(sugar[i]+water[j])))
# print(e/(100+e))
if maxSugar[0] == -1:
    print("1 0")
else:
    print("{} {}".format(maxSugar[2], maxSugar[1]))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = [int(i) for i in input().split()]
waterA = [a * 100 * i for i in range(int(f / (100 * a)) + 1)]
waterB = [b * 100 * i for i in range(int(f / (100 * b)) + 1)]
sugarC = [c * i for i in range(int(f / c) + 1)]
sugarD = [d * i for i in range(int(f / d) + 1)]

# まず水が何100gにできるかを算出(<F)
_water = []
for i in range(int(f / (100 * a)) + 1):
    for j in range(int(f / (100 * b)) + 1):
        if 100 * a * i + 100 * b * j <= f:
            _water.append(100 * a * i + 100 * b * j)
_water = sorted(_water)[1:]
water = [_water[0]]
for i in range(1, len(_water)):
    if _water[i] != _water[i - 1]:
        water.append(_water[i])
# 砂糖が何gにできるかを算出(<F)
_sugar = []
for i in range(int(f / c) + 1):
    for j in range(int(f / d) + 1):
        if c * i + d * j <= f:
            _sugar.append(c * i + d * j)
_sugar = sorted(_sugar)[1:]
sugar = [_sugar[0]]
for i in range(1, len(_sugar)):
    if _sugar[i] != _sugar[i - 1]:
        sugar.append(_sugar[i])
# print(water)
# print(sugar)
# 各場合で砂糖の最大量を計算
maxSugar = [-1, -1, -1]  # [dense, sugar, total]
for i in range(len(sugar)):
    for j in range(len(water)):
        if sugar[i] + water[j] > f:
            continue
        elif maxSugar[0] < sugar[i]/(sugar[i]+water[j]) <= e/(100+e):
            maxSugar[0] = sugar[i]/(sugar[i]+water[j])
            maxSugar[1] = sugar[i]
            maxSugar[2] = sugar[i] + water[j]
        # print("s:{} w:{} dense:{}".format(sugar[i], water[j], sugar[i]/(sugar[i]+water[j])))
# print(e/(100+e))
if maxSugar[0] == -1:
    print("0 0")
else:
    print("{} {}".format(maxSugar[2], maxSugar[1]))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans = []
water = []
for i in range(31):
    for j in range(31):
        tmp = 100*i*A + 100*j*B
        if tmp <= F:
            water.append(tmp)
water = list(set(water))
water.remove(0)

sugar = []
for i in range(101):
    for j in range(101):
        tmp = i*C + j*D
        if tmp <= F:
            sugar.append(tmp)
sugar = list(set(sugar))
sugar.remove(0)

            
for miz in water:
    for sato in sugar:
        if miz + sato <= F and (100 * sato) / (miz + sato) <= (100 * E) / (100 + E):
            ans.append([miz, sato, (miz * sato) / (miz + sato)])
            
if ans:
    ans.sort(key=lambda x:x[2], reverse = True)
    print(ans[0][0]+ans[0][1], ans[0][1])
else:
    print(water[0], 0)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f= (int(i) for i in input().split()) 
max_am=int(f/100/a)
max_bn=int(f/100/b)
max_cx=int(f/100*e/c)
max_dy=int(f/100*e/d)
satomizu=0
density=0

#print(max_am)
#print(max_bn)
#print(max_cx)
#print(max_dy)

for i in range(1,max_am+1):
    for j in range(max_bn+1):
        for k in range(max_cx+1):
            for l in range(max_dy+1):
                if 100*a*i+100*b*j+c*k+d*l  <= f and c*k+d*l <= (a*i+b*j)*e and density <= (c*k+d*l)/(100*a*i+100*b*j+c*k+d*l) :
                    satomizu=100*a*i+100*b*j+c*k+d*l
                    density = (c*k+d*l)/(100*a*i+100*b*j+c*k+d*l)
print(int(satomizu),int(satomizu*density))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
res=chk=0
ans=[]

for i in range(16):
    for j in range(16):
        for k in range(1501):
            w=(i*a)+(j*b)
            s=(k*c)
            if w==0:
                pass
            elif w+s>f:
                break
            else:
                o=(w//100)*e
                s+=(min(f-w-s,max(0,o-s))//d)*d
                if len(ans)==0:
                    ans=[s/(w+s),w+s,s]
                elif s/(w+s)>ans[0]:
                    ans=[s/(w+s),w+s,s]
print(ans[1],ans[2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
res=chk=0
ans=[]

for i in range(16):
    for j in range(16):
        for k in range(1501):
            w=(i*a)+(j*b)
            s=(k*c)
            if w==0:
                pass
            elif w+s>f:
                break
            else:
                o=(w//100)*e
                s+=((min(f-w-s,max(0,o-s))//d)*d)
                if len(ans)==0:
                    ans=[s/(w+s),w+s,s]
                elif s/(w+s)>ans[0]:
                    ans=[s/(w+s),w+s,s]
print(ans[1],ans[2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
res=chk=0
ans=[]

for i in range(16):
    for j in range(16):
        for k in range(1501):
            w=(i*a)+(j*b)
            s=(k*c)
            if w==0:
                pass
            elif w+s>f:
                break
            else:
                o=(w//100)*e
                s+=((min(f-w-s,o-s)//d)*d)
                if len(ans)==0:
                    ans=[s/(w+s),w+s,s]
                elif s/(w+s)>ans[0]:
                    ans=[s/(w+s),w+s,s]
print(ans[1],ans[2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
res=chk=0
ans=[]

for i in range(16):
    for j in range(16):
        for k in range(1501):
            w=(i*a)+(j*b)
            s=(k*c)
            if w==0:
                pass
            elif w+s>f:
                break
            else:
                o=(w//100)*e
                s+=((min(f-w-s,o-s)//d)*d)
                if len(ans)==0:
                    ans=[s/(w+s),w+s,s]
                elif s/(w+s)>ans[0]:
                    ans=[s/(w+s),w+s,w]
print(ans[1],ans[2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
res=chk=0
ans=[]
for i in range(31):
    for j in range(31):
        for k in range(31):
            for l in range(31):
                w=i*a+j*b
                s=k*c+l*d
                if w+s==0: pass
                elif w+s<f and (100*s)//(w+s)<=e*(w//100):
                    res=max(res,(100*s)//(w+s))
                    ans=[w+s,s]
print(*ans)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
sugar = []
water = []
if A[2] == 1:
    sugar = [i for i in range(A[5]+1)]
else:
    for i in range(10 + (1 + A[5])//A[2]):
        for j in range(10 + (A[5]-A[2]*i+1)//A[3]):
            if A[2] * i + A[3] * j not in sugar and A[2] * i + A[3] * j <= 3000:
                sugar.append(A[2] * i + A[3] * j)
for i in range(2 + 31//A[0]):
    for j in range(2 + (31 - i)//A[1]):
        if A[0] * i + A[1] * j <= 30 and A[0] * i + A[1] * j not in water:
            water.append(A[0] * i + A[1] * j)
ans = 0
anssugar = 0
answater = water[1]
for i in sugar:
    for j in water:
        if i + j != 0:
            if ans < 100.0 * i / (i + j) and (i + 100 * j) <= A[5] and i  <= j * A[4]:
                ans = 100.0 * i / (i + j)
                anssugar = i
                answater = 100 * j

print(str(anssugar + answater)+" "+str(anssugar))

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
sugar = []
water = []
if A[2] == 1:
    sugar = [i for i in range(A[5]+1)]
else:
    for i in range(10 + (1 + A[5])//A[2]):
        for j in range(10 + (A[5]-A[2]*i+1)//A[3]):
            if A[2] * i + A[3] * j not in sugar and A[2] * i + A[3] * j <= 3000:
                sugar.append(A[2] * i + A[3] * j)
for i in range(2 + 31//A[0]):
    for j in range(2 + (31 - i)//A[1]):
        if A[0] * i + A[1] * j <= 30 and A[0] * i + A[1] * j not in water:
            water.append(A[0] * i + A[1] * j)
ans = 0
anssugar = 0
answater = 0
for i in sugar:
    for j in water:
        if i + j != 0:
            if ans < 100.0 * i / (i + j) and (i + 100 * j) <= A[5] and i  <= j * A[4]:
                ans = 100.0 * i / (i + j)
                anssugar = i
                answater = 100 * j
print(str(anssugar + answater)+" "+str(anssugar))

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
sugar = []
water = []
if A[2] == 1:
    sugar = [i for i in range(A[5]+1)]
else:
    for i in range((1 + A[5])//A[2]):
        for j in range((A[5]-A[2]*i+1)//A[3]):
            if A[2] * i + A[3] * j not in sugar and A[2] * i + A[3] * j <= 3000:
                sugar.append(A[2] * i + A[3] * j)
for i in range(1 + 31//A[0]):
    for j in range(1 + (31 - i)//A[1]):
        if A[0] * i + A[1] * j <= 30 and A[0] * i + A[1] * j not in water:
            water.append(A[0] * i + A[1] * j)
ans = 0
anssugar = 0
answater = 0
for i in sugar:
    for j in water:
        if i + j != 0:
            if ans < 100.0 * i / (i + j) and (i + 100 * j) <= A[5] and i  <= j * A[4]:
                ans = 100.0 * i / (i + j)
                anssugar = i
                answater = 100 * j
print(str(anssugar + answater)+" "+str(anssugar))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
waters,sugars = [],[]
ans_w = 0
ans_s = 0
ans_d = 0

for i in range(0,f//100+1):
    for j in range(0,f//100+1):
        w = 100*a*i + 100*b*j
        if w < f:
            waters.append(w)

for i in range(0,f+1):
    for j in range(0,f+1):
        s = c*i + d*j
        if s < f:
            sugars.append(s)

for w in waters:
    for s in sugars:
        if (w+s) <= f:
            s_e = w/100 * e
            if s_e < s or w+s == 0:
                continue
            if (100*s/(w+s)) > ans_d:
                ans_w = w
                ans_s = s
                ans_d = 100*s/(w+s)

if ans_w == ans_s == ans_d == 0:
    print('%d 0' % (a))
else:
    print('%d %d' % (ans_w+ans_s,ans_s))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
a_num = int(F/(100*A))
b_num = int(F/(100*B))
c_num = int(F/C)
concentration = 0
ans1 = 0
ans2 = 0
for i in range(a_num+1):
    a = i*100*A
    for j in range(b_num+1):
        b = j*100*B
        if a+b > F:
            break
        for k in range(c_num+1):
            c = k*C
            if a+b+c > F:
                break
            if ((a+b)/100)*E < c:
                break
            limit_e = ((a+b)/100)*E - c
            limit_f = (F - (a+b+c))

            d = min(int(limit_e/D)*D, int(int(limit_f/D)*D))
            if d < 0:
                break
            if a+b+c+d == 0:
                break
            _concentration = (100*(c+d))/(a+b+c+d)
            if _concentration > concentration:
                concentration = _concentration
                ans1 = a+b+c+d
                ans2 = c+d
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
import sys
a, b, c, d, e, f = map(int, input().split())

m = sys.maxsize
mlist = [0]*4

for x in range(int(f / (100*a)) + 1):
    for y in range(int((f - 100 * a * x) / 100*b) + 1):
        for z in range(min(int((f - 100* a * x - 100 * b * y) / c), int(((a*x + b*y) * e) / c)) + 1):
            for w in range(min(int((f - 100* a * x - 100 * b * y - c * z) / d), int(((a*x + b*y) * e - c*z) / d)) + 1):
                if (z != 0 or w != 0) and float((a*x + b*y) / (c*z + d*w)) <= m:
                    mlist = [x,y,z,w]
                    m = float((a*x + b*y) / (c*z + d*w))
print(100 * a * mlist[0] + 100 * b * mlist[1] + c * mlist[2] + d * mlist[3], c * mlist[2] + d * mlist[3])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    a, b, c, d, e, f = map(int, input().split())
    concentration = 0
    sugar_water_amount = 0
    sugar_amount = 0
    water_set = set()
    sugar_set = set()

    # See:
    # https://www.youtube.com/watch?v=nCHz87GMdpo
    for i in range(f + 1):
        for j in range(f + 1):
            y = c * i + d * j

            if y <= f:
                sugar_set.add(y)

    for k in range(0, f + 1, 100):
        for l in range(0, f + 1, 100):
            x = a * k + b * l

            if x <= f:
                water_set.add(x)

    for water in water_set:
        for sugar in sugar_set:
            if (water + sugar <= f) and (sugar <= e * (water // 100)) and (water + sugar > 0):
                candidate = (100 * sugar) / (water + sugar)

                if candidate > concentration:
                    concentration = candidate
                    sugar_water_amount = water + sugar
                    sugar_amount = sugar

    print(sugar_water_amount, sugar_amount)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
(a, b, c, d, e, f) = list(map(int, input().split()))
a *= 100
b *= 100

n = [[0, 0] for _ in range(f + 1)]
n[a][0] = a
for i in range(f + 1 - a):
    if n[i][0] != 0:
        n[i + a][0] = n[i][0] + a
if f >= b:
    n[b][0] = b
    for i in range(f + 1 - b):
        if n[i][0] != 0:
            n[i + b][0] = n[i][0] + b
for i in range(f + 1 - c):
    if n[i][0] == 0:
        continue
    tmpt = n[i][0] / 100
    if (c + n[i][1]) / tmpt <= e and n[i + c][1] / (i + c) < (n[i][1] + c) / (i + c):
            n[i + c][0] = n[i][0]
            n[i + c][1] = n[i][1] + c
for i in range(f + 1 - d):
    if n[i][0] == 0:
        continue
    tmpt = n[i][0] / 100
    if (d + n[i][1]) / tmpt <= e and n[i + d][1] / (i + d) < (n[i][1] + d) / (i + d):
            n[i + d][0] = n[i][0]
            n[i + d][1] = n[i][1] + d
maxp = [0, 100, 0]
for i in range(len(n)):
    if(n[i][1] != 0 and maxp[0] < n[i][1] / i):
        maxp = [n[i][1] / i] + n[i]
print(str(maxp[1] + maxp[2]) + ' ' + str(maxp[2]))

Submission status: Wrong Answer

Solution code:
def 解():
    iA,iB,iC,iD,iE,iF = [int(_) for _ in input().split()]
    #結局全検索
    d = {}
    iMaxA = iF // 100*iA
    for i in range(iMaxA+1):
        iMaxB = (iF - 100*iA*i) // iB
        for j in range(iMaxB + 1):
            if i==0 and j==0:
                continue
            iAB = 100*iA*i + 100*iB*j
            iUlim =min( iAB * iE // 100 , iF -iAB)
            iMaxC = iUlim //iC
            for k in range(iMaxC+1):
                l = (iUlim - iC*k ) //iD
                iCD = iC*k +iD*l
                if iUlim -iCD == 0:
                    print(iAB +iCD,iCD)
                    exit()
                else:
                    iKey = iUlim-iCD
                    if not iKey in d:
                        d[iKey] = (iAB +iCD,iCD)
    iMin = min(d.keys())
    print(" ".join(map(str,d[iMin])))
解()

Submission status: Wrong Answer

Solution code:
iA,iB,iC,iD,iE,iF = [int(_) for _ in input().split()]

#とりあえず全検索
d = {}
iMaxA = iF // 100*iA
for i in range(iMaxA+1):
    iMaxB = (iF - 100*iA*i) // iB
    for j in range(iMaxB + 1):
        if i==0 and j==0:
            continue
        iUlim = (iA*i + iB*j)*iE
        iMaxC = iUlim //iC
        for k in range(iMaxC+1):
            l = (iUlim - iC*k ) //iD
            if iUlim -iC*k -iD*l == 0:
                if 100*iA*i + 100*iB*j + iC*k +iD *l > iF:
                    continue
                else:
                    print(100*iA*i + 100*iB*j +iC*k +iD*l,iC*k+iD*l)
                    exit()
            else:
                iKey = iUlim-iC*k -iD*l
                if not iKey in d:
                    d[iKey] = (100*iA*i + 100*iB*j +iC*k +iD*l,iC*k+iD*l)
iMin = min(d.keys())
print(" ".join(map(str,d[iMin])))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())

max_c = 0
ans_sw = 0
ans_s = 0

water = set()
for a in range(0, F + 1, A * 100):
    for b in range(0, F - a + 1, B * 100):
        water.add(a + b)

suger = set()
for c in range(0, F + 1, C):
    for d in range(0, F - c + 1, D):
        suger.add(c + d)

for w in water:
    for s in suger:
        
        if s <= E * w // 100 and 0 < w + s <= F:
            c = s / (w + s)
            if max_c < c:
                max_c = c
                ans_sw = s + w
                ans_s = s

print(ans_sw, ans_s)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())

tmp_c = 0
ans_sw = 0
ans_s = 0

water = set()
for a in range(0, F + 1, A * 100):
    for b in range(0, F - a + 1, B * 100):
        water.add(a + b)

suger = set()
for c in range(0, F + 1, C):
    for d in range(0, F - c + 1, D):
        suger.add(c + d)

for w in water:
    for s in suger:
        
        if s == 0:
            concentration = 0
        else:
            concentration = s / (w + s)
                    
        if concentration <= E / (100 + E) and concentration > tmp_c and w + s <= F:
            ans_sw = s+w
            ans_s = s
            tmp_c = concentration

print(ans_sw, ans_s)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())

tmp_c = 0
ans_sw = 0
ans_s = 0

for a in range(0, F+1, A*100):
    for b in range(0, F+1 - a, B*100):
        for c in range(0, int(F/100 * E) + 1, C):
            for d in range(0, int(F/100 * E) + 1, D):

                w = a + b
                s = c + d
                if s == 0:
                    concentration = 0
                else:
                    concentration = s / (w + s)
                    
                if concentration <= E / (100 + E) and concentration > tmp_c and w + s <= F:
                    ans_sw = s+w
                    ans_s = s
                    tmp_c = concentration

print(ans_sw, ans_s)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

w = 0
s = 0
max_s = f * e // (100 + e)
max_a = f // (a * 100)
max_b = f // (b * 100)
max_c = max_s // c
max_d = max_s // d

ans = 0
ans_s = 0
ans_w = 0
for ia in range(max_a + 1):
    for ib in range(max_b + 1):
        temp_w = (ia * a + ib * b) * 100
        if temp_w > f:
            break
        for ic in range(max_c + 1):
            for id in range(max_d + 1):
                temp_s = ic * c + id * d
                if temp_s > min(temp_w * e / 100, f - temp_w):
                    break
                elif temp_s + temp_w > 0:
                    temp = temp_s / (temp_s + temp_w)
                    if temp > ans:
                        ans = temp
                        ans_s = temp_s
                        ans_w = temp_w

print((ans_w + ans_s), ans_s)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

w = 0
s = 0
max_w = f // 100
max_s = f * e // (100 + e)
max_a = f // (a * 100)
max_b = f // (b * 100)
max_c = max_s // c
max_d = max_s // d

ans = 0
ans_s = 0
ans_w = 0
for ia in range(max_a + 1):
    for ib in range(max_b + 1):
        temp_w = ia * a + ib * b
        if temp_w > max_w:
            break
        for ic in range(max_c + 1):
            for id in range(max_d + 1):
                temp_s = ic * c + id * d
                if temp_s > min(temp_w * e, max_s, f - temp_w * 100):
                    break
                elif temp_s + temp_w > 0:
                    temp = temp_s / (temp_s + temp_w * 100)
                    if temp > ans:
                        ans = temp
                        ans_s = temp_s
                        ans_w = temp_w

print((ans_w * 100 + ans_s), ans_s)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

w = 0
s = 0
max_w = f // 100
max_s = f * e // (100 + e)
max_a = max_w // a
max_b = max_w // b
max_c = max_s // c
max_d = max_s // d

ans = 0
ans_s = 0
ans_w = 0
for ia in range(max_a + 1):
    for ib in range(max_b + 1):
        temp_w = ia * a + ib * b
        if temp_w > max_w:
            break
        for ic in range(max_c + 1):
            for id in range(max_d + 1):
                temp_s = ic * c + id * d
                if temp_s > min(temp_w * e, max_s, f - temp_w * 100):
                    break
                elif temp_s + temp_w > 0:
                    temp = temp_s / (temp_s + temp_w * 100)
                    if temp > ans:
                        ans = temp
                        ans_s = temp_s
                        ans_w = temp_w

print((ans_w * 100 + ans_s), ans_s)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import itertools

A,B,C,D,E,F = map(int, input().split())

water_max = F // (E+100) * 100
suger_max = water_max * E // 100
ope1_max = water_max // (100*A)
ope3_max = suger_max // C

ope1 = [x for x in range(ope1_max+1)]
ope3 = [x for x in range(ope3_max+1)]

ans_list = []
for a,c in itertools.product(ope1, ope3):
    b = (water_max - 100*a*A) // (100*B)
    water_ans = 100*a*A + 100*b*B
    d = (E * water_ans // 100 - c*C) // D

    if water_ans > 0:
        suger_ans = c*C + d*D
        sugwat_ans = water_ans + suger_ans
        if suger_ans * 100 // water_ans <= E:
            temp = suger_ans * 100 / sugwat_ans
            ans_list.append([temp,sugwat_ans,suger_ans])

if len(ans_list) > 0 :
    ans_list.sort(key=lambda x:x[0])
    print(ans_list[-1][1],ans_list[-1][2])
else:
    print(0,0)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import itertools

A,B,C,D,E,F = map(int, input().split())

water_max = F // (E+100) * 100
suger_max = water_max * E // 100
ope1_max = water_max // (100*A)
ope3_max = suger_max // C

ope1 = [x for x in range(ope1_max+1)]
ope3 = [x for x in range(ope3_max+1)]

ans_list = []
for a,c in itertools.product(ope1, ope3):
    b = (water_max - 100*a*A) // (100*B)
    water_ans = 100*a*A + 100*b*B
    d = (E * water_ans // 100 - c*C) // D

    if water_ans > 0:
        suger_ans = c*C + d*D
        sugwat_ans = water_ans + suger_ans
        if suger_ans * 100 // water_ans <= E:
            temp = suger_ans * 100 / sugwat_ans
            ans_list.append([temp,sugwat_ans,suger_ans])

if len(ans_list) > 0 :
    ans_list.sort(key=lambda x:x[0])
    print(ans_list[-1][1],ans_list[-1][2])
else:
    print(100*A,0)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
A *= 100
B *= 100
Smax = E * F // 100
S, W = [False for i in range(Smax+1)], [False for i in range(F+1)]
S[0], W[0] = True, True
for i in range(1, len(S)):
    if i - C >= 0:
        if S[i-C] == True:
            S[i] = True
    if i - D >= 0:
        if S[i-D] == True:
            S[i] = True
for i in range(1, F+1):
    if i - A >= 0:
        if W[i-A] == True:
            W[i] = True
    if i - B >= 0:
        if W[i-B] == True:
            W[i] = True

conc = 0
ans = [0, 0]
for i in reversed(range(len(S))):
    if S[i] == True:
        for j in range(1, F-i+1):
            if W[j] == True and 100 * i <= j * E:
                if 100 * i / (i+j) > conc:
                    conc = 100 * i / (i+j)
                    ans = [i+j, i]
                    break
print(" ".join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int, input().split())
i = 1
while True:
    if E/100 >= C/(A*100*i):
        print(A*100*i + C, C)
        break
    if E/100 >= C/(B*100*i):
        print(B*100*i + C, C)
        break
    if E/100 >= D/(A*100*i):
        print(A*100*i + D, D)
        break
    if E/100 >= D/(B*100*i):
        print(B*100*i + D, D)
        break
    i += 1