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:
# coding: utf-8
# Here your code !
xi=list(map(int,input().rstrip().split()))
A=xi[0]*100
B=xi[1]*100
C=xi[2]
D=xi[3]
E=xi[4]
F=xi[5]
 
tmpAllMax=-1
tmpSMax=-1
tmpNoudMax=-1
 
for iA in range(31):
    for iB in range(31):
        for iC in range(31):
            for iD in range(31):
                tmpWSum=(iA*A+iB*B)
                tmpSSum=(iC*C+iD*D)
                if( (tmpWSum+tmpSSum) > F):
                    break
                if( (tmpWSum*E/100)<tmpSSum ):
                    break
                #濃度
                if( tmpWSum+tmpSSum==0 ):
                    break
                noud=100*tmpSSum/(tmpWSum+tmpSSum)
                if( noud>tmpNoudMax):
                    tmpNoudMax=noud
                    tmpAllMax=(tmpWSum+tmpSSum)
                    tmpSMax=tmpSSum
print(tmpAllMax,tmpSMax,flush=True)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = [int(v) for v in input().split()]
# print(A, B, C, D, E, F)
An = [(100*A)*(v) for v in range(int(F/(100*A))+1)]
Bn = [(100*B)*(v) for v in range(int(F/(100*B))+1)]
# print(An, Bn, 1)


def per1(RE):
  MAX_C = int(RE/C)
  # print(int(RE/C))
  r = 0
  for ri in [v+1 for v in reversed(range(MAX_C))]:
    minus_param = ri * C
    check_max_d = RE - minus_param
    d_size = int(check_max_d / D)
    minus_param -= d_size * D
    if r < minus_param:
      r = minus_param
  return r
  
  
max_suger_per = 0
max_water = 0
max_suger = 0
for v in Bn:
  for w in An:
    s = v + w
    if s > F or s == 0: continue
    re = int(s * E / 100)
    if s + re > F: re = F - s
    # print(s, re)
    result = per1(re)
    # print(result)
    suger = (100 * result) / (s + result)
    if suger > max_suger_per:
      max_suger_per = suger
      max_water = s + result
      max_suger = result
    
print(max_water, max_suger)

Submission status: Wrong Answer

Solution code:
import math

ABCDEF = input()
split_ABCDEF = ABCDEF.split()
int_split_ABCDEF = [int(i) for i in split_ABCDEF]
A = int_split_ABCDEF[0]*100
B = int_split_ABCDEF[1]*100
C = int_split_ABCDEF[2]
D = int_split_ABCDEF[3]
E = int_split_ABCDEF[4]
F = int_split_ABCDEF[5]

flag = True
if A > B:
    sugar = int((B / 100) * E)
    if sugar % C != 0 and sugar % D != 0:
        C_sugar = 0
        D_sugar = 0
        while flag:
            C_sugar += C
            if C_sugar > sugar:
                flag = False
                C_sugar -= C

        while flag:
            D_sugar += D
            if D_sugar > sugar:
                flag = False
                D_sugar -= D

        if D_sugar > C_sugar:
            sugar = D_sugar
        else:
            sugar = C_sugar
        print("{} {}".format(sugar+B, sugar))
    else:
        print("{} {}".format(sugar+B, sugar))
else:
    sugar = int((A / 100) * E)
    if sugar % C != 0 and sugar % D != 0:
        C_sugar = 0
        D_sugar = 0
        while flag:
            C_sugar += C
            if C_sugar > sugar:
                print(flag)
                flag = False
                C_sugar -= C

        while flag:
            D_sugar += D
            if D_sugar > sugar:
                flag = False
                D_sugar -= D

        if D_sugar > C_sugar:
            sugar = D_sugar
        else:
            sugar = C_sugar
        print("{} {}".format(sugar+A, sugar))
    else:
        print("{} {}".format(sugar+A, sugar))

Submission status: Wrong Answer

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

w_m=0
s_m=0

a_max=F/(100*A)
b_max=F/(100*B)

def sugar(w):
    c_max=(F-w)/C
    d_max=(F-w)/D
    m=0
    for c in range(0,c_max+1):
        for d in range(0,d_max+1):
            if (C*c+D*d)>E*w/100 or (C*c+D*d)+w>F:
                continue
            elif (C*c+D*d)>m:
                m=(C*c+D*d)
    return m

m=0.
for a in range(0,a_max+1):
    for b in range(0,b_max+1):
        w=100*(A*a+B*b)
        if w>F:
            continue
        s=sugar(w)
        if (w+s)==0 or w+s>F:
            continue
        elif 100.*s/(w+s)>m:
            m=100.*s/(w+s)
            w_m=w
            s_m=s

print int(w_m+s_m),s_m

Submission status: Wrong Answer

Solution code:
import fractions
a = list(map(int,input().split()))

g = 100 + a[4]
h = a[5] // g

water = [0] * (h + 1)
suger = [0] * (a[4] * h + 1)
water[0] = 1
suger[0] = 1

for j in range(100):
    for i in range(h, -1, -1):
        if i - a[0] >= 0:
            water[i] = max(water[i], water[i - a[0]])
        if i - a[1] >= 0:
            water[i] = max(water[i], water[i - a[1]])

for j in range(100):
    for i in range(a[4] * h, -1, -1):
        if i - a[2] >= 0:
            suger[i] = max(suger[i], suger[i - a[2]])
        if i - a[3] >= 0:
            suger[i] = max(suger[i], suger[i - a[3]])

ans = [0] * 3
for i in range(1, h + 1):
    if water[i] == 0:
        continue
    for j in range(a[4]):
        if suger[i * a[4] - j] == 1:
            if fractions.Fraction(i * a[4] - j ,i * 100) > ans[2]:
                ans = [i * 100 + i * a[4] - j, i * a[4] - j, \
                    fractions.Fraction(i * a[4] - j ,i * 100)]

if ans[0] == 0:
    print(a[0] * 100, 0)
else:
    print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
best_water=0
best_salt=0
best_rate=0
for i in range(30//A+1):#Aの投入数
  for j in range(30//B+1):#Bの投入数
    water=(i*A+j*B)*100
    if water<=F and water:
      max_salt=(i*A+j*B)*E
      for k in range(max_salt//C+1):#Cを何個使うか
        l=(max_salt-C*k)//D#Dは何個つかえるか
        salt=k*C+l*D
        rate=100*salt/(water+salt)
        if rate>best_rate and rate<E and water+salt <=F:
          best_rate=rate
          best_salt=salt
          best_water=water
print(best_water+best_salt,best_salt)

Submission status: Wrong Answer

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

max = 0
water = 0
sugar = 0
flag = True

i = 1
while(f >= 100 * a * i and flag == True):
    j = 0
    while(f >= 100 * (a * i + b * j) and flag == True):
        k = 0
        while(f >= 100 * (a * i + b * j) + c * k and flag == True):
            l = 0
            while(f >= 100 * (a * i + b * j) + c * k + d * l and flag == True):
                n = 100 * (c * k + d * l) / (100 * (a * i + b * j) + c * k + d * l)
                if(n > 100 * e / (100 + e)):
                    break
                if(max < n):
                    max = n
                    if(water * 2 == 100 * (a * i + b * j) and sugar * 2 == c * k + d * l):
                        flag = not(flag)
                    water = 100 * (a * i + b * j)
                    sugar = c * k + d * l
                l += 1
            k += 1
        j += 1
    i += 1

print("%d %d" %(water + sugar, sugar))

Submission status: Wrong Answer

Solution code:
import fractions
a = list(map(int,input().split()))

g = 100 + a[4]
h = a[5] // g

water = [0] * (h + 1)
suger = [0] * (a[4] * h + 1)
water[0] = 1
suger[0] = 1

for j in range(100):
    for i in range(h, -1, -1):
        if i - a[0] >= 0:
            water[i] = max(water[i], water[i - a[0]])
        if i - a[1] >= 0:
            water[i] = max(water[i], water[i - a[1]])

for j in range(100):
    for i in range(a[4] * h, -1, -1):
        if i - a[2] >= 0:
            suger[i] = max(suger[i], suger[i - a[2]])
        if i - a[3] >= 0:
            suger[i] = max(suger[i], suger[i - a[3]])

ans = [0] * 3
for i in range(1, h + 1):
    if water[i] == 0:
        continue
    for j in range(a[4]):
        if suger[i * a[4] - j] == 1:
            if fractions.Fraction(i * a[4] - j ,i * 100) > ans[2]:
                ans = [i * 100 + i * a[4] - j, i * a[4] - j, \
                    fractions.Fraction(i * a[4] - j ,i * 100)]

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    A, B, C, D, E, F = list(map(int, input().split()))

    # A+B のアリエル値
    a_plus_b = set()
    for i in range(0, 31, A):
        for j in range(0, 31, B):
            if not (i == 0 and j == 0):
                if i + j <= 30:
                    a_plus_b.add(i + j)

    c_plus_d = set()
    for i in range(0, 2901, C):
        for j in range(0, 2901, D):
            if i + j <= 2900:
                c_plus_d.add(i + j)

    max_concent = 0
    ans_sum = 0
    ans_sugar = 0
    for cd in c_plus_d:
        for ab in a_plus_b:
            if cd <= E * ab and cd <= F - 100 * ab:
                if max_concent < cd / ab:
                    max_concent = cd / ab
                    ans_sum = 100 * ab + cd
                    ans_sugar = cd

    print(str(ans_sum) + " " + str(ans_sugar))

Submission status: Wrong Answer

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

w_m=0
s_m=0

a_max=F/(100*A)
b_max=F/(100*B)

def sugar(w):
    c_max=(F-w)/C
    d_max=(F-w)/D
    m=0
    for c in range(0,c_max+1):
        for d in range(0,d_max+1):
            if (C*c+D*d)>E*w/100 or (C*c+D*d)+w>F:
                continue
            elif (C*c+D*d)>m:
                m=(C*c+D*d)
    return m

m=0
for a in range(0,a_max+1):
    for b in range(0,b_max+1):
        w=100*(A*a+B*b)
        if w>F:
            continue
        s=sugar(w)
        if (w+s)==0 or w+s>F:
            continue
        elif 100*s/(w+s)>m:
            m=100*s/(w+s)
            w_m=w
            s_m=s

print int(w_m+s_m),s_m

Submission status: Wrong Answer

Solution code:

A, B, C, D, E, F = map(int, input().split())
# A:水を100Ag　B:水を100Bg C:砂糖をCg D:砂糖をDg E:100gあたりの溶ける最大量　F:入れられる物質の質量の限界

mizu1 = min(A,B)
situryo1 = 100*mizu1
sato1 = 0
howaryo1 = mizu1 * E

for i in range(howaryo1//C):
    for j in range(howaryo1//D):
        if C*i + j*D <= howaryo1:
            sato1 = max(C*i + j*D, sato1)


mizu2 = max(A,B)
situryo2 = 100*mizu2
sato2 = 0
howaryo2 = mizu2 * E

for i in range(howaryo2//C):
    for j in range(howaryo2//D):
        if C*i + j*D <= howaryo1:
            sato2 = max(C*i + j*D, sato2)


if (sato1/situryo1) > (sato2/situryo2):
    print(situryo1+sato1,sato1)
else:
    print(situryo2+sato2,sato2)

Submission status: Wrong Answer

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

min_sugar = min(C, D)
max_suger = max(C, D)

max_s = 0
max_l = 0
max_r = 0

for a in range(30):
    for b in range(30):
        if a == 0 and b == 0:
            break
        w = 100*A*a + 100*B*b
        s = (A*a+B*b)*E
        for c in range(100):
            for d in range(100):
                if s >= C*c + D*d and w + C*c + D*d <= F:
                    if (C*c+D*d)/(w + C*c+D*d) > max_s:
                        max_s = (C*c+D*d)/(w + C*c+D*d)
                        max_l = w+C*c + D*d
                        max_r =  C*c+D*d
print(max_l, max_r)

Submission status: Wrong Answer

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

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

e = float(E)
a = float(100 * A)
b = float(100 * B)
c = float(C)
d = float(D)
f = F

max_con = 0.0
maxes = [0, 0]

q = [[a, c], [a, d], [b, c], [b, d]]


while len(q) != 0:
    tmp = []
    key = q.pop(0)
    if key[1] / key[0] <= e / 100 and key[0] + key[1] <= f:
        if max_con < func(key[0], key[1]):
            max_con = func(key[0], key[1])
            maxes[0], maxes[1] = key[0], key[1]
            tmp += [key[0], key[1] + c]
            tmp += [key[0], key[1] + d]
        else:
            tmp += [key[0] + a, key[1]]
            tmp += [key[0] + b, key[1]]

    if len(tmp) > 0:
        q.append(tmp)

print int(maxes[0] + maxes[1]), int(maxes[1])

Submission status: Wrong Answer

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

w_m=0
s_m=0

a_max=F/(100*A)
b_max=F/(100*B)

def sugar(w):
    c_max=(F-w)/C
    d_max=(F-w)/D
    m=0
    for c in range(0,c_max+1):
        for d in range(0,d_max+1):
            if (C*c+D*d)>E*w/100:
                continue
            elif (C*c+D*d)>m:
                m=(C*c+D*d)
    return m

m=0
for a in range(0,a_max+1):
    for b in range(0,b_max+1):
        w=100*(A*a+B*b)
        if w>F:
            continue
        s=sugar(w)
        if (w+s)==0 or w+s>F:
            continue
        elif 100*s/(w+s)>m:
            m=100*s/(w+s)
            w_m=w
            s_m=s

print int(w_m+s_m),s_m

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100
if f < a + c:
    print("0 0")
    raise SystemExit

water_cands = set()
t = 0
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, 0, 0
for w in water_cands:
    if w == 0:
        continue
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = 0
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100
if f < a + c:
    print("0 0")
    raise SystemExit

water_cands = set()
t = a
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, 0, 0
for w in water_cands:
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = 0
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)

Submission status: Wrong Answer

Solution code:
x_list = input().split()
a = 100*int(x_list[0])
b = 100*int(x_list[1])
c = int(x_list[2])
d = int(x_list[3])
e = int(x_list[4])
f = int(x_list[5])

max_sato = e*f/100//1
max_mizu = f

def all_pattern(a,b,c):
    max_a = int(c//a)
    all_list = []
    for i in range(max_a+1):
        goukei = 0
        goukei += a*i
        j = 0
        while goukei <= c:
            if not goukei in all_list:
                all_list.append(goukei)
            goukei += b
    return all_list

mizu_pattern = all_pattern(a,b,max_mizu)
sato_pattern = all_pattern(c,d,max_sato)

satosui_situryo = 0
sato_situryo = 0
max_noudo = 0

for mizu in mizu_pattern:
    for sato in sato_pattern:
#         print(sato,mizu)
        if sato + mizu > 0:
            tmp_noudo = sato/(sato+mizu)*100
#             print(tmp_noudo)
            if max_noudo < tmp_noudo and tmp_noudo <= e/(100+e)*100 and mizu+sato <= f:
                max_noudo = tmp_noudo
                satosui_situryo = mizu + sato
                sato_situryo = sato
#                 print("a:",max_noudo,satosui_situryo,sato_situryo)

print(satosui_situryo,sato_situryo)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100
if f < a + c:
    print("0 0")
    raise SystemExit

water_cands = set()
t = a
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, 0, 0
for w in water_cands:
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = c
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
xi=list(map(int,input().rstrip().split()))
A=xi[0]*100
B=xi[1]*100
C=xi[2]
D=xi[3]
E=xi[4]
F=xi[5]

tmpAllMax=0
tmpSMax=0
tmpNoudMax=0

for iA in range(31):
    for iB in range(31):
        for iC in range(31):
            for iD in range(31):
                tmpWSum=(iA*A+iB*B)
                tmpSSum=(iC*C+iD*D)
                if( (tmpWSum+tmpSSum) > F):
                    break
                if( (tmpWSum*E/100)<tmpSSum ):
                    break
                #濃度
                if( tmpWSum+tmpSSum==0 ):
                    break
                noud=100*tmpSSum/(tmpWSum+tmpSSum)
                if( noud>tmpNoudMax):
                    tmpNoudMax=noud
                    tmpAllMax=(tmpWSum+tmpSSum)
                    tmpSMax=tmpSSum
print(tmpAllMax,tmpSMax,flush=True)

Submission status: Wrong Answer

Solution code:
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]

[a,b,c,d,e,f]=i2()
g=[]
for i in range(31):
    for j in range(31):
                ttt=(a*i+b*j)*100
                tk=min(ttt*e/100,f-ttt)
                tt=(tk//d)*d+(tk%d//(d-c))*(d-c)
                t=ttt+tt
                if t>0 :
                    g.append([(100*tt)/t,t,tt])

g.sort()
print(int(g[-1][1]),int(g[-1][2]))

Submission status: Wrong Answer

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

for a in range(31):
    for b in range(31):
        for c in range(31):
            for d in range(31):
                if a == 0 and b == 0:
                    continue
                if (100*A)*a + (100*B)*b + C*c + D*d > F:
                    continue
                if C*c + D*d > E:
                    continue
                density = 100 * C*c+D*d / ( (100*A)*a + (100*B)*b + C*c + D*d )
                memo[a,b,c,d] = density

max_v = max(memo.values())

for k, v in memo.items():
    if v == max_v:
        print((100*A)*k[0] + (100*B)*k[1] + min(C*k[2] + D*k[3], E), min(C*k[2] + D*k[3], E) )
        break

Submission status: Wrong Answer

Solution code:
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]

[a,b,c,d,e,f]=i2()
g=[]
for i in range(31):
    for j in range(31):
                ttt=(a*i+b*j)*100
                tk=min(ttt*e/100,f-ttt)
                tt=(tk//d)*d+(tk%d//(d-c))*(d-c)
                t=ttt+tt
                if t>0 :
                    g.append([(100*tt)/t,t,tt])

g.sort()
print(g[-1][1],g[-1][2])

Submission status: Wrong Answer

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

inlist = list(map(int, input().split()))
a = inlist[0] * 100
b = inlist[1] * 100
c = inlist[2]
d = inlist[3]
e = inlist[4]
f = inlist[5]

tupleList = []

for i in range((f//a) + 1):
    for j in range((f - a*i)//b + 1):
        for k in range((f - a*i - b * j)//c + 1):
            for l in range((f - a*i - b*j - c*k)//d + 1):
                if (c*k + d*l)*(100 + e) <= (a*i + b*j + c*k + d*l)*e:
                    tupleList.append([i, j, k, l])
tupleList.remove([0, 0, 0, 0])

def concentration(i, j, k, l):
    return (c*k + d*l)/(a*i + b*j + c*k + d*l)

max_con = concentration(tupleList[0][0], tupleList[0][1], tupleList[0][2], tupleList[0][3])
max_tuple = tupleList[0]

for i in range(len(tupleList) - 1):
    if concentration(tupleList[i][0], tupleList[i][1], tupleList[i][2], tupleList[i][3]) \
        < concentration(tupleList[i+1][0], tupleList[i+1][1], tupleList[i+1][2], tupleList[i+1][3]):
        max_con = concentration(tupleList[i + 1][0], tupleList[i + 1][1], tupleList[i + 1][2], tupleList[i + 1][3])
        max_tuple = tupleList[i + 1]

print(str(a*max_tuple[0] + b*max_tuple[1] + c*max_tuple[2] + d*max_tuple[3]) \
      + " " + str(c*max_tuple[2] + d*max_tuple[3]))

Submission status: Wrong Answer

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

max = 0
water = 0
sugar = 0

i = 1
while(f >= 100 * a * i):
    j = 0
    while(f >= 100 * (a * i + b * j)):
        k = 0
        while(f >= 100 * (a * i + b * j) + c * k):
            l = 0
            while(f >= 100 * (a * i + b * j) + c * k + d * l):
                n = 100 * (c * k + d * l) / (100 * (a * i + b * j) + c * k + d * l)
                if(n > 100 * e / (100 + e)):
                    break
                if(max < n):
                    max = n
                    water = 100 * (a * i + b * j)
                    sugar = c * k + d * l
                l += 1
            k += 1
        j += 1
    i += 1

print("%d %d" %(water + sugar, sugar))

Submission status: Wrong Answer

Solution code:

A, B, C, D, E, F = map(int, input().split())
# A:水を100Ag　B:水を100Bg C:砂糖をCg D:砂糖をDg E:100gあたりの溶ける最大量　F:入れられる物質の質量の限界

mizu1 = min(A,B)
situryo1 = 100*mizu1
sato1 = 0
howaryo1 = mizu1 * E

while True:
    if (situryo1 + max(C,D) <= F) & (sato1 + max(C,D) <= howaryo1):
        situryo1 += max(C,D)
        sato1 += max(C,D)
    elif (situryo1 + min(C,D) <= F) & (sato1 + min(C,D) <= howaryo1):
        situryo1 += min(C,D)
        sato1 += min(C,D)
    else:
        break
    
mizu2 = max(A,B)
situryo2 = 100*mizu2
sato2 = 0
howaryo2 = mizu2 * E

while True:
    if (situryo2 + max(C,D) <= F) & (sato2 + max(C,D) <= howaryo2):
        situryo2 += max(C,D)
        sato2 += max(C,D)
    elif (situryo2 + min(C,D) <= F) & (sato2 + min(C,D) <= howaryo2):
        situryo2 += min(C,D)
        sato2 += min(C,D)
    else:
        break
    
if (sato1/situryo1) > (sato2/situryo2):
    print(situryo1,sato1)
else:
    print(situryo2,sato2)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = [int(i) for i in input().split()]
    
w = 0
t = min(A,B)
w += t * 100
l = t * E
c =(l // C) * C
d = (l // D) * D

s = 0
for i in range(c+1):
    for j in range(d+1):
        k = i * C + j *D
        if k <= l and w+s <= F:
            s = max(k,s)
print(w+s, s)

Submission status: Wrong Answer

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

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

e = float(E)
a = float(100 * A)
b = float(100 * B)
c = float(C)
d = float(D)
f = F


con = float((e / 100) * 100)
max_con = 0.0
maxes = [0, 0]

q = [[a, c], [a, d], [b, c], [b, d]]


while len(q) != 0:
    tmp = []
    key = q.pop(0)
    if func(key[0], key[1]) <= con and key[0] + key[1] <= f:
        tmp += [key[0] + a, key[1] + c]
        tmp += [key[0] + a, key[1] + d]
        tmp += [key[0] + b, key[1] + c]
        tmp += [key[0] + b, key[1] + d]
        if max_con < func(key[0], key[1]):
            max_con = func(key[0], key[1])
            maxes[0], maxes[1] = key[0], key[1]

    if len(tmp) > 0:
        q.append(tmp)

print int(maxes[0] + maxes[1]), int(maxes[1])

Submission status: Wrong Answer

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

y = 0
ys = 100*A
yx = 0
W = {}
for a in range(F//100 + 1):
    for b in range(F//200 + 1):
        w = 100*A*a + 100*B*b
        if w <= F:
            W[w] = 0
        
for w in W.keys():
    for c in range(min(F-w, (E*w//100)) + 1):
        for d in range(min(F-w, (E*w//100))//2 + 1):
            s = C*c + D*d
            x = w + s
            try:
                if s+w <= F and s/x <= E/(100+E):
                    if s/x > y:
                        y = s/x
                        ys = s
                        yx = x
            except ZeroDivisionError:
                pass
                
print(yx, ys)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

def main():
    A, B, C, D, E, F = [int(x) for x in input().split()]
    N = F // 100
    max_rate = E / (100 + E)
    best_weight, best_suger, best_rate = 0, 0, 0.0
    for a in range(N+1):
        for b in range((F-a*A)//100 + 1):
            water = (a*A+b*B)*100
            if water > F:
                continue
            for c in range((F - water) // C + 1):
                d = min((F - water - c*C) // D, int((E*water-100*c*C) / (100*D)))
                if d < 0:
                    continue
                suger = c*C + d*D
                if water + suger > F:
                    continue
                if water + suger == 0:
                    rate = 0.0
                else:
                    rate = suger / (water + suger)
                if rate > max_rate:
                    continue
                if rate > best_rate:
                    best_weight = water + suger
                    best_suger = suger
                    best_rate = rate
    print(best_weight, best_suger)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

def main():
    A, B, C, D, E, F = [int(x) for x in input().split()]
    N = F // 100
    max_rate = E / (100 + E)
    best_weight, best_suger, best_rate = 0, 0, 0.0
    for a in range(N+1):
        for b in range((F-a*A)//100 + 1):
            water = (a*A+b*B)*100
            if water > F:
                continue
            for c in range(F - water + 1):
                d = min((F - water - c*C) // D, int((E*water-100*c*C) / (100*D)))
                if d < 0:
                    continue
                suger = c*C + d*D
                if water + suger > F:
                    continue
                if water + suger == 0:
                    rate = 0.0
                else:
                    rate = suger / (water + suger)
                if rate > max_rate:
                    continue
                if rate > best_rate:
                    best_weight = water + suger
                    best_suger = suger
                    best_rate = rate
    print(best_weight, best_suger)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

x = 0
y = 0
z = 0

a = 0
while a <= F:
    b = 0
    while a + b <= F:
        if a == 0 and b == 0:
            break
        c = 0
        while a + b + c <= F:
            d = 0
            while a + b + c + d <= F:
                if (c + d) / (a + b) > E / 100:
                    break
                if (c + d) / (a + b + c + d) > z:
                    x = a + b + c + d
                    y = c + d
                    z = y / x
                d += D
            c += C
        b += 100 * B
    a += 100 * A

print(" ".join(map(str, [x, y])))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

def main():
    A, B, C, D, E, F = [int(x) for x in input().split()]
    N = F // 100
    max_rate = E / (100 + E)
    best_weight, best_suger, best_rate = 0, 0, 0.0
    for a in range(N+1):
        for b in range(N - a*A + 1):
            water = (a*A+b*B)*100
            if water > F:
                continue
            for c in range(F - water + 1):
                d = min((F - water - c*C) // D, int((E*water-100*c*C) / (100*D)))
                if d < 0:
                    continue
                suger = c*C + d*D
                if water + suger > F:
                    continue
                if water + suger == 0:
                    rate = 0.0
                else:
                    rate = suger / (water + suger)
                if rate > max_rate:
                    continue
                if rate > best_rate:
                    best_weight = water + suger
                    best_suger = suger
                    best_rate = rate
    print(best_weight, best_suger)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

counter = []

cnta = 1
cntb = 0
while (cnta * A) <= F:
  while (cnta * A + cntb * B) <= F:
    counter.append([cnta, cntb])
    cntb += 1
  cnta += 1
  cntb = 0

water = []
for c in counter:
  water.append(c[0] * A + c[1] * B)
water = list(set(water))

def sugar(water,C,D,E,F):
  sugar = []
  limit = water / 100 * E
  cntc = 0
  cntd = 0
  while cntc * C <= limit and cntc * C + water <= F:
    while cntc * C + cntd * D <= limit and cntc * C + cntd * D + water <= F:
      sugar.append(cntc * C + cntd * D)
      cntd += 1
    cntc += 1
    cntd = 0
  return max(sugar)

maxconc = [0,0,0]
for w in water:
  s = sugar(w,C,D,E,F)
  conc = s/(w+s)
  if conc > maxconc[2]:
    maxconc = [w+s, s, conc]

print(" ".join(map(str, maxconc[0:2])))

Submission status: Wrong Answer

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

ws = set()
i = j = 0
while True:
    j = 0
    if B*i > F//100: break
    while True:
        w = B*i + A*j
        if w > F//100: break
        ws.add(w)
        j += 1
    i += 1
ws = list(ws)
ws.sort()

ss = set()
i = j = 0
while True:
    j = 0
    if D*i > F: break
    while True:
        s = D*i + C*j
        if s > F: break
        ss.add(s)
        j += 1
    i += 1
ss = list(ss)
ss.sort()

limit = E / (100+E)
sugar = C
water = rate = 0
for w in ws:
    w = w*100
    if w == 0: continue
    if w > F: break
    for s in ss:
        if w+s > F: break
        r = s / (w+s)
        if r > limit: break
        if r > rate:
            rate = r
            water = w
            sugar = s
print(water+sugar, sugar)