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 -*-
A, B, C, D, E, F = map(int, input().split())

i = 0
j = 0
X = []

while A*i <= F:
    j = 0
    while A*i + B*j <= F:
        X.append(A*i + B*j)
        j += 100
    i += 100
X = sorted(list(set(X)))

i = 0
j = 0
Y = []

while C*i <= F:
    j = 0
    while C*i + D*j <= F:
        Y.append(C*i + D*j)
        j += 1
    i += 1
Y = sorted(list(set(Y)))

ans1 = 0
ans2 = 0
max_con = 0

for x in X[:]:
    for y in Y:
        if x + y > F:
            break
        elif x + y != 0:
            con = 100*y / (x + y)
            if con > max_con and y <= E*x/100:
                ans1 = x + y
                ans2 = y
                max_con = con

print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
A, B, C, D, E, F = map(int, input().split())

i = 0
j = 0
X = []

while A*i <= F:
    j = 0
    while A*i + B*j <= F:
        X.append(A*i + B*j)
        j += 100
    i += 100
X = sorted(list(set(X)))

i = 0
j = 0
Y = []

while C*i <= F:
    j = 0
    while C*i + D*j <= F:
        Y.append(C*i + D*j)
        j += 1
    i += 1
Y = sorted(list(set(Y)))

ans1 = 0
ans2 = 0
max_con = 0

for x in X[1:]:
    for y in Y:
        if x + y > F:
            break
        elif x + y != 0:
            con = 100*y / (x + y)
            if con > max_con and y <= E*x/100:
                ans1 = x + y
                ans2 = y
                max_con = con

print(ans1,ans2)

Submission status: Wrong Answer

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

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

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

ans = [0, 0]
mx = 0
for w in W:
    for s in S:
        if 0 < w + s <= F and s <= w * E // 100:
            if mx < s/(w+s):
                ans = w+s, s
                mx = s/(w+s)
print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Oct  8 14:30:54 2018
ABC074C
@author: maezawa
"""

a, b, c, d, e, f = list(map(int, input().split()))

pos_water = set([])
pos_sugar = set([])
max_water = f
max_sugar = f*e//100

for i in range(max_water//100//a+1):
    for j in range(max_water//100//b+1):
        if 100*(i*a + j*b) > max_water:
            break
        else:
            pos_water.add(100*(i*a + j*b))

for i in range(max_sugar//c+1):
    for j in range(max_sugar//d):
        if i*c + j*d > max_sugar:
            break
        else:
            pos_sugar.add(i*c + j*d)

water = list(pos_water)
water.sort()
sugars = list(pos_sugar)
sugars.sort()
water.remove(0)

#print(water)
#print(sugars)

ans_weight = 0
ans_sugar = 0
max_conc = 0
for w in water:
    nextw = 0
    for s in sugars:
        conc = s/(s+w)
        weight = s+w
        #print(w, s, conc, weight)
        if weight > f:
            nextw = 1
            break
        if conc > e/(100+e):
            nextw = 1
            break
        if conc > max_conc:
            max_conc = conc
            ans_weight = weight
            ans_sugar = s

print(ans_weight, ans_sugar)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Oct  8 14:30:54 2018
ABC074C
@author: maezawa
"""

a, b, c, d, e, f = list(map(int, input().split()))

pos_water = set([])
pos_sugar = set([])
max_water = f
max_sugar = f*e//100

for i in range(max_water//100//a+1):
    for j in range(max_water//100//b+1):
        if 100*(i*a + j*b) > max_water:
            break
        else:
            pos_water.add(100*(i*a + j*b))

for i in range(max_sugar//c+1):
    for j in range(max_sugar//d):
        if i*c + j*d > max_sugar:
            break
        else:
            pos_sugar.add(i*c + j*d)

water = list(pos_water)
water.sort()
sugars = list(pos_sugar)
sugars.sort()
water.remove(0)

print(water)
print(sugars)

ans_weight = 0
ans_sugar = 0
max_conc = 0
for w in water:
    nextw = 0
    for s in sugars:
        conc = s/(s+w)
        weight = s+w
        #print(w, s, conc, weight)
        if weight > f:
            nextw = 1
            break
        if conc > e/(100+e):
            nextw = 1
            break
        if conc > max_conc:
            max_conc = conc
            ans_weight = weight
            ans_sugar = s

print(ans_weight, ans_sugar)

Submission status: Wrong Answer

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

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

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

best_w = best_s = best_r = 0.0
for water in sorted(waters):
    for sugar in sorted(sugars):
        if water + sugar > F: break
        if water*E < sugar*100: break
        rate = sugar / (water + sugar)
        if rate > best_r:
            best_r = rate
            best_w = water
            best_s = sugar
print(best_s+best_w, best_s)

Submission status: Wrong Answer

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

water_set = set()
sugar_set = set()

for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        if a + b <= F:
            water_set.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        if c + d <= F//2 + 1:
            sugar_set.add(c + d)

water_set.remove(0)
water_list = list(water_set)
sugar_list = list(sugar_set)

cons = 0
water_ans = 0
sugar_ans = 0
for water in water_list:
    for sugar in sugar_list:
        if water + sugar <= F and sugar * 100 <= E * water:
            if 100 * sugar / (water + sugar) > cons:
                cons = 100 * sugar / (water + sugar)
                water_ans = water
                sugar_ans = sugar

print(water_ans + sugar_ans, sugar_ans)

Submission status: Wrong Answer

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

water_set = set()
sugar_set = set()

for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        if a + b <= F:
            water_set.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        if c + d <= F//2 + 1:
            sugar_set.add(c + d)

water_set.remove(0)
water_list = list(water_set)
sugar_list = list(sugar_set)

cons = 0
water_ans = 0
sugar_ans = 0
for water in water_list:
    for sugar in sugar_list:
        if water + sugar <= F and sugar * 100 <= E * water:
            if 100 * sugar / (water + sugar) > cons:
                cons = 100 * water / (water + sugar)
                water_ans = water
                sugar_ans = sugar

print(water_ans + sugar_ans, sugar_ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c,d,e,f = li()

water_set = set()
sugar_set = set()

MAX = 3000

# ありうる水と砂糖の重さ
for ai in range(0,MAX//100+1,a):
    for bi in range(0,MAX//100+1,b):
        if 0 < 100 * (ai + bi) <= MAX:
            water_set.add(100 * (ai + bi))

water_list = sorted(list(water_set))

for ci in range(0,30*e+1,c):
    for di in range(0,30*e+1,d):
        if ci + di <= 30*e:
            sugar_set.add(ci+di)
            
sugar_list = sorted(list(sugar_set))

node_max = 0
sw = 0
sg = 0

for wi in water_list:
    for si in sugar_list:
        if wi+si <= f and si <= e * (wi//100):
            node = (100*si) / (wi+si)
            if node > node_max:
                sw = si + wi
                sg = si
                node_max = node
                
print(sw,sg)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b,c,d,e,f = li()

water_set = set()
sugar_set = set()

MAX = 3000

# ありうる水と砂糖の重さ
for ai in range(0,MAX//100+1,a):
    for bi in range(0,MAX//100+1,b):
        if 0 < 100 * (ai + bi) <= MAX:
            water_set.add(100 * (ai + bi))

water_list = sorted(list(water_set))

for ci in range(0,30*e+1,c):
    for di in range(0,30*e+1,d):
        if 0 < ci + di <= 30*e:
            sugar_set.add(ci+di)
            
sugar_list = sorted(list(sugar_set))

node_max = 0
sw = 0
sg = 0

for wi in water_list:
    for si in sugar_list:
        if wi+si <= f and si <= e * (wi//100):
            node = (100*si) / (wi+si)
            if node > node_max:
                sw = si + wi
                sg = si
                node_max = node
                
print(sw,sg)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
num = None
rec = 0
for a in range(101):
    for b in range(101):
        if a * A * 100 + b * B * 100 > F:
            break
        for c in range(100):
            if a * A * 100 + b * B * 100 + c * C > F:
                break
            for d in range(100):
                q = a * A * 100 + b * B * 100
                p = C * c + D * d
                if p > E * (a * A + b * B):
                    continue
                if p + q == 0:
                    continue
                if p + q <= F:
                    if rec < 100 * p / (p + q):
                        rec = 100 * p / (p + q)
                        num = (p + q, p)
                else:
                    break

if not num:
    print(100, 0)
else:
    print(num[0], num[1])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
num = None
rec = 0
for a in range(101):
    for b in range(101):
        if a * A * 100 + b * B * 100 > F:
            break
        for c in range(100):
            if a * A * 100 + b * B * 100 + c * C > F:
                break
            for d in range(100):
                q = a * A * 100 + b * B * 100
                p = C * c + D * d
                if p > E * (a * A + b * B):
                    continue
                if p + q == 0:
                    continue
                if p + q <= F:
                    if rec < 100 * p / (p + q):
                        rec = 100 * p / (p + q)
                        num = (p + q, p)
                else:
                    break

if not num:
    print(0, 0)
else:
    print(num[0], num[1])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
num = None
rec = 0
for a in range(101):
    for b in range(101):
        if a * A * 100 + b * B * 100 > F:
            break
        for c in range(100):
            if a * A * 100 + b * B * 100 + c * C > F:
                break
            for d in range(100):
                q = a * A * 100 + b * B * 100
                p = C * c + D * d
                if p > E * (a * A + b * B):
                    continue
                if p + q == 0:
                    continue
                if p + q <= F:
                    if rec < 100 * p / (p + q):
                        rec = 100 * p / (p + q)
                        num = (p + q, p)
                else:
                    break

if not num:
    print(0)
else:
    print(num[0], num[1])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = 100
ans2 = 0
n = 0
for x in range(100, F+1, 100):
    for y in range(F+1):
        if x + y == 0:
            continue        
        if x + y > F:
            continue
        if (x / 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break
        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if n < (y/(x+y)):
            n = y/(x+y)
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(0, F+1, 100):
    for y in range(F+1):
        if x + y == 0:
            continue        
        if x + y > F:
            continue
        if (x / 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break
        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if n < (y/(x+y)):
            n = y/(x+y)
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(100, F+1, 100):
    for y in range(F+1):
        if x + y == 0:
            continue        
        if x + y > F:
            continue
        if (x / 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break
        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if n < (y/(x+y)):
            n = y/(x+y)
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(100, F+1, 100):
    for y in range(F+1):
        if x + y == 0:
            continue        
        if x + y > F:
            continue
        if (x / 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break
        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if n < (y/x+y):
            n = y/x+y
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(0, F+1, 100):
    for y in range(F+1):
        if x + y == 0:
            continue        
        if x + y > F:
            continue
        if (x / 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break
        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if n < (y/x+y):
            n = y/x+y
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(0, F+1, 100):
    for y in range(F+1):
        if x + y > F:
            continue
        if (x // 100) * E < y:
            continue

        s = []
        for i in range(1,(y//C)+1):
            for j in range(1,(y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break

        if len(s) == 0:
            continue

        w = []
        for i in range(1,(x//(100*A))+1):
            for j in range(1,(x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if x + y == 0:
            continue
        if n < (y/x+y):
            n = y/x+y
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(0, F+1, 100):
    for y in range(F+1):
        if x + y > F:
            continue
        if (x // 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break

        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if x + y == 0:
            continue
        if n < (y/x+y):
            n = y/x+y
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(0, F+1, 100):
    for y in range(F+1):
        if x + y > F:
            continue
        if (x // 100) * E < y:
            continue

        s = []
        for i in range((y//C)+1):
            for j in range((y//D)+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break

        if len(s) == 0:
            continue

        w = []
        for i in range((x//(100*A))+1):
            for j in range((x//(100*B))+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if x + y == 0:
            continue
        if n < (y/x+y):
            n = y/x+y
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans1 = ans2 = 0
n = 0
for x in range(0, F+1, 100):
    for y in range(F+1):
        if x + y > F:
            continue
        if (x // 100) * E < y:
            continue

        s = []
        for i in range(y//C+1):
            for j in range(y//D+1):
                if y == i * C + j * D:
                    s.append((i, j))
                    break
            if len(s):
                break

        if len(s) == 0:
            continue

        w = []
        for i in range(x//(100*A)+1):
            for j in range(x//(100*B)+1):
                if x == 100 * A * i + 100 * B * j:
                    w.append((i, j))
                    break
            if len(w):
                break

        if len(w) == 0:
            continue

        if x + y == 0:
            continue
        if n < (y/x+y):
            n = y/x+y
            ans1 = x + y
            ans2 = y

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int, input().split())
total = 0
sugar = 0
p,q,r,s = 0,0,0,0
p_max,q_max,r_max,s_max = 0,0,0,0
p_max = f // (100*a)
q_max = f // (100*b)
r_max = int((0.01 * f * e) // c)
s_max = int((0.01 * f * e) // d)
set_water = set()
set_sugar = set()

for p in range(0,p_max+1):
    for q in range(0,q_max+1):
        if 100*(a*p + b*q) <= f:
            set_water.add(100*(p*a+q*b))
for r in range(0,r_max+1):
    for s in range(0,s_max+1):
        if c*r + d*s <= 0.01*f*e:
            set_sugar.add(r*c+s*d)
conc_max = 0
max_sugar = 0
max_tot = 0
for water in set_water:
    for sugar in set_sugar:
        if water + sugar > f:
            pass
        elif water == 0 or sugar == 0:
            pass
        elif sugar / water > 0.01*e:
            pass
        else:
            conc = sugar / (water+sugar)
            if conc >= conc_max:
                conc_max = conc
                max_sugar = sugar
                max_tot = water+sugar
            else:
                pass

print(max_tot,max_sugar)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int, input().split())
total = 0
sugar = 0
p,q,r,s = 0,0,0,0
p_max,q_max,r_max,s_max = 0,0,0,0
p_max = f // (100*a)
q_max = f // (100*b)
r_max = int((0.01 * f * e) // c)
s_max = int((0.01 * f * e) // d)
set_water = set()
set_sugar = set()

for p in range(0,p_max+1):
    for q in range(0,q_max+1):
        if 100*(a*p + b*q) <= f:
            set_water.add(100*(p*a+q*b))
for r in range(0,r_max+1):
    for s in range(0,s_max+1):
        if c*r + d*s <= 0.01*f*e:
            set_sugar.add(r*c+s*d)
conc_max = 0
max_sugar = 0
max_tot = 0
for water in set_water:
    for sugar in set_sugar:
        if water + sugar > f:
            pass
        elif water == 0 or sugar == 0:
            pass
        elif sugar / water > 0.01*e:
            pass
        else:
            conc = sugar / (water+sugar)
            if conc > conc_max:
                conc_max = conc
                max_sugar = sugar
                max_tot = water+sugar
            else:
                pass

print(max_tot,max_sugar)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int, input().split())
total = 0
sugar = 0
p,q,r,s = 0,0,0,0
p_max,q_max,r_max,s_max = 0,0,0,0
p_max = f // (100*a)
q_max = f // (100*b)
r_max = int((0.01 * f * e) // c)
s_max = int((0.01 * f * e) // d)
set_water = set()
set_sugar = set()

for p in range(0,p_max+1):
    for q in range(0,q_max+1):
        if 100*(a*p + b*q) <= f:
            set_water.add(100*(p*a+q*b))
for r in range(0,r_max):
    for s in range(0,s_max):
        if c*r + d*s <= 0.01*f*e:
            set_sugar.add(r*c+s*d)
conc_max = 0
max_sugar = 0
max_tot = 0
for water in set_water:
    for sugar in set_sugar:
        if water + sugar > f:
            pass
        elif water == 0 or sugar == 0:
            pass
        elif sugar / water > 0.01*e:
            pass
        else:
            conc = sugar / (water+sugar)
            if conc > conc_max:
                conc_max = conc
                max_sugar = sugar
                max_tot = water+sugar
            else:
                pass

print(max_tot,max_sugar)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[[0,0]]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w+1):
    for k in range(0,m+1,c):
      for n in range(0,m-i+1,d):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[[0,0]]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w+1):
    for k in range(0,m//c+1,c):
      for n in range(0,(m-k*c)//d+1,d):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[[0,0]]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w+1):
    for k in range(0,m//c+1,c):
      flag=0
      for n in range(0,(m-k*c)//d+1,d):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[[0,0]]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w+1):
    for k in range(m//c+1):
      flag=0
      for n in range((m-k*c)//d+1,0,-1):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[]
m=int(f*e/100)
for i in range(int(f//a)):
  for j in range((f-100*i)//b):
    for k in range(m//c):
      for n in range((m-k*c)//d):
        X=100*a*i+100*b*j
        Y=k*c+n*d 
        print(0)
        if X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          print(1)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
            else:
              pass
          else:
            continue
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = list(map(int, input().split()))
res = [0, 0]
max_nodo = 0
max_anum = f // (a*100)+1
if c == 0 and d == 0:
    print(str(a*100) + " 0")
    exit()
for anum in range(max_anum):
    max_bnum = (f - anum*100) // (b*100) + 1
    for bnum in range(max_bnum):
        try:
            max_cnum = (f - anum*100 - bnum*100) // c + 1
        except:
            max_cnum = 1
        water = anum*a*100 + bnum*b*100
        if anum == 0 and bnum == 0:
            break
        for cnum in range(max_cnum):
            try:
                max_dnum = (f - anum*100 - bnum*100 - cnum*c) // d + 1
            except:
                max_dnum = 1
            for dnum in range(max_dnum):
                suger = cnum*c + dnum*d
                nodo = (suger*100) / (water + suger)
                if nodo > (e*100)/(100+e) or water + suger > f:
                    break
                if max_nodo < nodo:
                    max_nodo = nodo
                    res[0] = water + suger
                    res[1] = suger
print(str(res[0]) + " " + str(res[1]))