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=map(int,input().split())
water=[]
sugar=[]
ans,ans_2,con=0,0,0
for i in range(f+1):
    for j in range(f+1):
        x=100*a*i+100*j*b
        if 0<x<=f:
            water.append(x)
for i in range(f+1):
    for j in range(f+1):
        y=c*i+d*j
        if 0<y<=f:
            sugar.append(y)

for i in water:
    for j in sugar:
        if i+j<=f:
            if j<=i//100*e:
                now=(100*j)//(i+j)
                if con<now:
                    ans=i+j
                    ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
max_sugar=int(float(E)/(100+E)*F)

a=set()
for i in range(max_sugar+1):
	for j in range(max_sugar):
		#print i,j
		if i*C+D*j<= max_sugar:
			a.add(i*C+D*j)

b=set()
cnt=F/100
for i in range(cnt+1):
	for j in range(cnt+1):
		if A*i*100+B*j*100<=F and A*i*100+B*j*100!=0:
			b.add(A*i*100+B*j*100)

#print a
#print b

noudo=float(E)/(100+E)*100
max_noudo=0
ans=A*100,0

for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		#print i,j
		if t_noudo <= noudo and t_noudo > max_noudo:
			#print i,j,t_noudo
			max_noudo=t_noudo
			ans=i+j,i

print ans[0],ans[1]

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
max_sugar=int(float(E)/(100+E)*F)

a=set()
for i in range(max_sugar+1):
	for j in range(max_sugar):
		#print i,j
		if i*C+D*j<= max_sugar:
			a.add(i*C+D*j)

b=set()
cnt=F/100
for i in range(cnt+1):
	for j in range(cnt+1):
		if A*i*100+B*j*100<=F and A*i*100+B*j*100!=0:
			b.add(A*i*100+B*j*100)

#print a
#print b

noudo=float(E)/(100+E)*100
max_noudo=0
ans=0
for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		#print i,j
		if t_noudo<=noudo and t_noudo> max_noudo:
			#print i,j,t_noudo
			max_noudo=t_noudo
			ans=i+j,i

if ans==0:
	print F/100*100,0
else:
	print ans[0],ans[1]

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
max_sugar=int(float(E)/(100+E)*F)
#print max_sugar

a=set()
for i in range(max_sugar):
	for j in range(max_sugar):
		#print i,j
		if i*C+D*j<= max_sugar:
			a.add(i*C+D*j)

b=set()
cnt=F/100
for i in range(cnt+1):
	for j in range(cnt+1):
		if A*i*100+B*j*100<=F and A*i*100+B*j*100!=0:
			b.add(A*i*100+B*j*100)

#print a
#print b

noudo=float(E)/(100+E)*100
max_noudo=0
ans=0
for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		#print i,j
		if t_noudo<=noudo and t_noudo> max_noudo:
			#print i,j,t_noudo
			max_noudo=t_noudo
			ans=i,j

if ans==0:
	print F/100*100,0
else:
	print ans[0]+ans[1],ans[0]

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
max_sugar=int(float(E)/(100+E)*F)
#print max_sugar

a=set()
for i in range(max_sugar):
	for j in range(max_sugar):
		#print i,j
		if i*C+D*j<= max_sugar:
			a.add(i*C+D*j)

b=set()
cnt=F/100
for i in range(cnt+1):
	for j in range(cnt+1):
		if A*i*100+B*j*100<=F and A*i*100+B*j*100!=0:
			b.add(A*i*100+B*j*100)

#print a
#print b

noudo=float(E)/(100+E)*100
max_noudo=0
ans=0
for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		#print i,j
		if t_noudo<=noudo and t_noudo> max_noudo:
			#print i,j,t_noudo
			max_noudo=t_noudo
			ans=i,j

if ans==0:
	print F,0
else:
	print ans[0]+ans[1],ans[0]

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
max_sugar=int(float(E)/(100+E)*F)

a=set()
for i in range(max_sugar):
	for j in range(max_sugar):
		#print i,j
		if i*C+D*j<= max_sugar:
			a.add(i*C+D*j)

b=set()
cnt=F/100
for i in range(cnt):
	for j in range(cnt):
		if i*100+j*100<=F and i*100+j*100!=0:
			b.add(i*100+j*100)

#print a
#print b

noudo=float(E)/(100+E)*100
max_noudo=0
ans=0
for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		#print i,j
		if t_noudo<=noudo and t_noudo> max_noudo:
			#print i,j,t_noudo
			max_noudo=t_noudo
			ans=i,j

if ans==0:
	print F,0
else:
	print ans[0]+ans[1],ans[0]

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
max_sugar=int(float(E)/(100+E)*F)

a=set()
for i in range(max_sugar):
	for j in range(max_sugar):
		#print i,j
		if i*C+D*j<= max_sugar:
			a.add(i*C+D*j)

b=set()
cnt=F/100
for i in range(cnt):
	for j in range(cnt):
		if i*100+j*100<=F and i*100+j*100!=0:
			b.add(i*100+j*100)

#print a
#print b

noudo=float(E)/(100+E)*100
max_noudo=0
ans=0
for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		#print i,j
		if t_noudo<noudo and t_noudo> max_noudo:
			#print i,j,t_noudo
			max_noudo=t_noudo
			ans=i,j

if ans==0:
	print F,0
else:
	print ans[0]+ans[1],ans[0]

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, raw_input().split())
noudo=int(float(E)/(100+E)*100)

a=[]
for i in range(noudo):
	for j in range(noudo):
		#print i,j
		if i*C+D*j<=noudo:
			a.append(i*C+D*j)

b=[]
cnt=F/100
for i in range(cnt):
	for j in range(cnt):
		if i*100+j*100<=F and i*100+j*100!=0:
			b.append(i*100+j*100)


noudo=float(E)/(100+E)*100
max_noudo=0
ans=0
for i in a:
	for j in b:
		t_noudo=float(i)/(i+j)*100
		if t_noudo>max_noudo:
			max_noudo=t_noudo
			ans=i,j

if ans==0:
	print F,0
else:
	print ans[0]+ans[1],ans[0]

Submission status: Wrong Answer

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


water = set()
for i in range(31):
    for j in range(31):
        water.add(A*i + B*j)
water = list(filter(lambda x: x <= F, water))
sugar = set()
for i in range(3001):
    for j in range(3001):
        sugar.add(C*i + D*j)
sugar = list(filter(lambda x: x<=F, sugar))

node_max = 0
ans_w, ans_s = 0, 0
for w in water:
    howa = w * E
    for s in sugar:
        if s > E or w + s > F or s+w == 0:
            continue
        else:
            node = (100*s)/(s+w)
            if node > node_max:
                node_max = node
                ans_w = w
                ans_s = s

print(ans_w+ans_s, ans_s)

Submission status: Wrong Answer

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


water = set()
for i in range(31):
    for j in range(31):
        water.add(A*i + B*j)
water = list(filter(lambda x: x <= F, water))
sugar = set()
for i in range(3001):
    for j in range(3001):
        sugar.add(C*i + D*j)
sugar = list(filter(lambda x: x<=F, sugar))

node_max = 0
ans_w, ans_s = 0, 0
for w in water:
    howa = w * E
    for s in sugar:
        if s > E or w + s > F or s+w == 0:
            continue
        else:
            node = (100*s)/(s+w)
            print(node)
            if node > node_max:
                node_max = node
                ans_w = w
                ans_s = s

print(ans_w+ans_s, ans_s)

Submission status: Wrong Answer

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


water = set()
for i in range(31):
    for j in range(31):
        water.add(A*i + B*j)
water = list(filter(lambda x: x <= F, water))
sugar = set()
for i in range(3001):
    for j in range(3001):
        sugar.add(C*i + D*j)
sugar = list(filter(lambda x: x<=F, sugar))
print(water)
print(sugar)
node_max = 0
ans_w, ans_s = 0, 0
for w in water:
    howa = w * E
    for s in sugar:
        if s > E or w + s > F or s+w == 0:
            continue
        else:
            node = (100*s)/(s+w)
            print(node)
            if node > node_max:
                node_max = node
                ans_w = w
                ans_s = s

print(ans_w+ans_s, ans_s)

Submission status: Wrong Answer

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

ans_water = 0
ans_sugar = 0
ans_dorodoro = 0
for a in range(31):
    for b in range(31):
        if A*a + B*b > F:
            continue
        for c in range(501):
            for d in range(501):
                if A*a + B*b + C*c + D*d > F or A*a + B*b + C*c + D*d == 0:
                    continue

                water = A*a + B*b
                howa = water * E / 100
                sugar = C*c + D*d
                if sugar > howa:
                    continue
                dorodoro = (100*sugar)/(water+sugar)

                if ans_dorodoro < dorodoro <= E:
                    ans_dorodoro = dorodoro
                    ans_water = water
                    ans_sugar = sugar
                #print(ans_dorodoro, dorodoro, ans_water, ans_sugar)
print(ans_water+ans_sugar, ans_sugar)

Submission status: Wrong Answer

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

ans_water = 0
ans_sugar = 0
ans_dorodoro = 0
for a in range(31):
    for b in range(31):
        if A*a + B*b > F:
            continue
        for c in range(301):
            for d in range(301):
                if A*a + B*b + C*c + D*d > F or A*a + B*b + C*c + D*d == 0:
                    continue

                water = A*a + B*b
                howa = water * E / 100
                sugar = C*c + D*d
                if sugar > howa:
                    continue
                dorodoro = (100*sugar)/(water+sugar)

                if ans_dorodoro < dorodoro <= E:
                    ans_dorodoro = dorodoro
                    ans_water = water
                    ans_sugar = sugar
                #print(ans_dorodoro, dorodoro, ans_water, ans_sugar)
print(ans_water+ans_sugar, ans_sugar)

Submission status: Wrong Answer

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

ans_water = 0
ans_sugar = 0
ans_dorodoro = 0
for a in range(31):
    for b in range(31):
        for c in range(100):
            for d in range(100):
                if A*a + B*b + C*c + D*d > F or A*a + B*b + C*c + D*d == 0:
                    continue

                water = A*a + B*b
                howa = water * E / 100
                sugar = C*c + D*d
                if sugar > howa:
                    continue
                dorodoro = (100*sugar)/(water+sugar)

                if ans_dorodoro < dorodoro <= E:
                    ans_dorodoro = dorodoro
                    ans_water = water
                    ans_sugar = sugar
                #print(ans_dorodoro, dorodoro, ans_water, ans_sugar)
print(ans_water+ans_sugar, ans_sugar)

Submission status: Wrong Answer

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

ans_water = 0
ans_sugar = 0
ans_dorodoro = 0
for a in range(31):
    for b in range(31):
        for c in range(60):
            for d in range(60):
                if A*a + B*b + C*c + D*d > F or A*a + B*b + C*c + D*d == 0:
                    continue

                water = A*a + B*b
                howa = water * E / 100
                sugar = C*c + D*d
                if sugar > howa:
                    continue
                dorodoro = (100*sugar)/(water+sugar)

                if ans_dorodoro < dorodoro <= E:
                    ans_dorodoro = dorodoro
                    ans_water = water
                    ans_sugar = sugar
                #print(ans_dorodoro, dorodoro, ans_water, ans_sugar)
print(ans_water+ans_sugar, ans_sugar)

Submission status: Wrong Answer

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

waters = set()
for wb in range(0,F+1,100*B):
    wa = 0
    while wa + wb <= F:
        waters.add(wa + wb)
        wa += 100*A
waters.remove(0)

sugars = set()
for sd in range(0,F+1,D):
    sc = 0
    while sc + sd <= F:
        sugars.add(sc + sd)
        sc += C

best = 0.0
best_w = best_s = 0
for w in sorted(waters):
    for s in sorted(sugars):
        if 100*s > w*E: continue
        if w+s > F: continue
        if best < 100*s / (w+s):
            best = 100*s / (w+s)
            best_w = w
            best_s = s

print(best_w+best_s, best_s)

Submission status: Wrong Answer

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

waters = set()
wa = 100*A
while wa <= F:
    waters.add(wa)
    wa += 100*A
wb = 100*B
while wb <= F:
    waters.add(wb)
    wb += 100*B

sugars = set()
sc = C
while sc <= F:
    sugars.add(sc)
    sc += C
sd = D
while sd <= F:
    sugars.add(sd)
    sd += D

best = 0.0
best_w = best_s = 0
for w in sorted(waters):
    for s in sorted(sugars):
        if 100*s > w*E: continue
        if w+s > F: continue
        if best < 100*s / (w+s):
            best = 100*s / (w+s)
            best_w = w
            best_s = s
print(best_w+best_s, best_s)

Submission status: Wrong Answer

Solution code:
from math import ceil, floor


def exist(A, B, x):
    """
    check if i and j exist such that Ai + Bj = x
    """
    max_i = x // A + 1
    for i in range(max_i + 1):
        if (x - A * i) % B == 0:
            return True
    else:
        return False


A, B, C, D, E, F = [int(elem) for elem in input().split(' ')]

max_density = 0.
status_when_max_dens = {'water': 0, 'sugar': 0}
for x in range(1, F + 1):
    if exist(100 * A, 100 * B, x):
        for y in range(F - x + 1):
            if exist(C, D, y):
                density = y / (x + y)
                if (density >= max_density)\
                and (y <= x / 100 * E)\
                and (x + y <= F):
                    max_density = density
                    status_when_max_dens['water'] = x
                    status_when_max_dens['sugar'] = y


water = status_when_max_dens['water']
sugar = status_when_max_dens['sugar']
print(water + sugar, sugar)

max_density = 0.
status_when_max_dens = {'water': 0, 'sugar': 0}
for x in range(1, F+1):
    if exist(100 * A, 100 * B, x):
        for y in range(1, F+1):
            if exist(C, D, y):
                density = y / (x + y)
                if (density > max_density)\
                and (y <= x / 100 * E)\
                and (x + y <= F):
                    max_density = density
                    status_when_max_dens['water'] = x
                    status_when_max_dens['sugar'] = y


water = status_when_max_dens['water']
sugar = status_when_max_dens['sugar']
print(water + sugar, sugar)

Submission status: Wrong Answer

Solution code:
from math import ceil, floor


def exist(A, B, x):
    """
    check if i and j exist such that Ai + Bj = x
    """
    max_i = x // A
    for i in range(max_i + 1):
        if (x - A * i) % B == 0:
            return True
    else:
        return False


A, B, C, D, E, F = [int(elem) for elem in input().split(' ')]

max_density = 0.
status_when_max_dens = {'water': 0, 'sugar': 0}
for x in range(1, F+1):
    if exist(100 * A, 100 * B, x):
        for y in range(1, F+1):
            if exist(C, D, y):
                density = y / (x + y)
                if (density > max_density)\
                and (y <= x / 100 * E)\
                and (x + y <= F):
                    max_density = density
                    status_when_max_dens['water'] = x
                    status_when_max_dens['sugar'] = y


water = status_when_max_dens['water']
sugar = status_when_max_dens['sugar']
print(water + sugar, sugar)

Submission status: Wrong Answer

Solution code:
from math import ceil, floor


def exist(A, B, x):
    """
    check if i and j exist such that Ai + Bj = x
    """
    max_i = x // A
    for i in range(max_i + 1):
        if (x - A * i) % B == 0:
            return True
    else:
        return False


A, B, C, D, E, F = [int(elem) for elem in input().split(' ')]

max_density = 0.
status_when_max_dens = {'water': 0, 'sugar': 0}
for x in range(1, F):
    if exist(100 * A, 100 * B, x):
        for y in range(1, F):
            if exist(C, D, y):
                density = y / (x + y)
                if (density > max_density)\
                and (y <= x / 100 * E)\
                and (x + y <= F):
                    max_density = density
                    status_when_max_dens['water'] = x
                    status_when_max_dens['sugar'] = y

print(status_when_max_dens['water'] + status_when_max_dens['sugar'], status_when_max_dens['sugar'])

Submission status: Wrong Answer

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

for i in range(100*a, f+1, 100):
    b_max = i // (100*b)
    for j in range(0, b_max+1):
        if (i-j*b*100) % (100*a) == 0:
            break
    else:
        continue

    sugar = 0
    for k in range(0, i//100*e+1):
        d_max = k // d
        for l in range(0, d_max+1):
            if (k-d*l) % c == 0:
                if k > sugar and i + k <= f:
                    sugar = k
    
    if sugar / (i+sugar) * 100 > con:
        con = sugar / (i+sugar) * 100
        w, s = i, sugar

print("{} {}".format(w+s, s))

Submission status: Wrong Answer

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

for i in range(100*a, f+1, 100):
    b_max = i // (100*b)
    for j in range(0, b_max+1):
        if (i-j*b*100) % (100*a) == 0:
            break
    else:
        continue

    sugar = -1
    for k in range(0, i//100*e+1):
        d_max = k // d
        for l in range(0, d_max+1):
            if (k-d*l) % c == 0:
                if k > sugar and i + k <= f:
                    sugar = k

    if sugar == -1:
        break

    if sugar / (i+sugar) * 100 > con:
        con = sugar / (i+sugar) * 100
        w, s = i, sugar

print("{} {}".format(w+s, s))

Submission status: Wrong Answer

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

for a in range(31):
    for b in range(31):
        if 0<100*(a*A+b*B)<F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if 0<c*C+d*D<F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = -1
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if t < (s*100)/(m+s) <= (100*E)/(E+100) and m+s<=F:
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(1+F//100):
    for b in range(1+F//100):
        if 100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))

for c in range(1+F//C):
    for d in range(1+F//D):
        if c*C+d*D<=F:
            S.append(c*C+d*D)

ans1 = 0
ans2 = 0
t = 0
for m in M:
    for s in S:
        if m==s==0:
            pass
        elif m+s<=F and s<=E*m//100 and t<(100*s)/(s+m):
            t = (100*s)/(s+m)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(1+F//100):
    for b in range(1+F//100):
        if 100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if c*C+d*D<=F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if m==s==0:
            pass
        elif s<=E*(m//100) and m+s<=F and t<(s*100)/(m+s):
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(1+F//100):
    for b in range(1+F//100):
        if 100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if c*C+d*D<=F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)
print(M)
print(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if m==s==0:
            pass
        elif s<=E*(m//100) and m+s<=F and t<(s*100)/(m+s):
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(1+F//100):
    for b in range(1+F//100):
        if 100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if c*C+d*D<=F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if m==s==0:
            pass
        elif s<=E*m//100 and m+s<=F and t<(s*100)/(m+s):
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(1+F//100):
    for b in range(1+F//100):
        if 0<100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if 0<c*C+d*D<=F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if s<=E*m//100 and m+s<=F and t<=(s*100)/(m+s):
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(1+F//100):
    for b in range(1+F//100):
        if 0<100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if 0<c*C+d*D<=F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if 0<s<=E*m/100 and m+s<=F and t<(s*100)/(m+s):
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(F//100):
    for b in range(F//100):
        if 0<100*(a*A+b*B)<=F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if 0<c*C+d*D<=F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if t < (s*100)/(m+s) <= (100*E)/(E+100) and m+s<=F:
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(31):
    for b in range(31):
        if 0<100*(a*A+b*B)<F:
            M.append(100*(a*A+b*B))
for c in range(F//C):
    for d in range(F//D):
        if 0<c*C+d*D<F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if t < (s*100)/(m+s) <= (100*E)/(E+100) and m+s<=F:
            t = (s*100)/(m+s)
            ans1 = m+s
            ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

for a in range(31):
    for b in range(31):
        if 100*(a*A+b*B)<F:
            M.append(100*(a*A+b*B))
for c in range(3001):
    for d in range(3001):
        if c*C+d*D<F:
            S.append(c*C+d*D)
M = set(M)
S = set(S)

t = 0
ans1 = 0
ans2 = 0
for m in M:
    for s in S:
        if m>0 and s>0:
            if t < (s*100)/(m+s) <= (100*E)/(E+100) and m+s<=F:
                t = (s*100)/(m+s)
                ans1 = m+s
                ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=s=[]
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if x<=f:
            w.append(x)
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
max_con=0
ans,ans_2=0,0
for i in w:
    for j in s:
        if i==0 and j==0:
            continue
        elif e*(i//100)<j:
            continue
        elif f<i+j:
            continue
        else:
            con=(100*j)/(i+j)
            if max_con<=con:
                max_con=con
                ans=i+j
                ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=[]
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if x<=f:
            w.append(x)
s=[]
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
max_con=0
ans,ans_2=0,0
for i in w:
    for j in s:
        if i!=0 and j!=0:
            if j<=e*(i//100):
                if i+j<=f:
                    con=(100*j)/(i+j)
                    if max_con<=con:
                        max_con=con
                        ans=i+j
                        ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=[]
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if x<=f:
            w.append(x)
s=[]
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
max_con=0
ans,ans_2=0,0
for i in w:
    for j in s:
        if i!=0 and j!=0 and i+j<=f and j<=e*(i//100):
            con=(100*j)/(i+j)
            if max_con<=con:
                max_con=con
                ans=i+j
                ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=[]
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if x<=f and 0<x:
            w.append(x)
s=[]
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f and 0<y:
            s.append(y)
max_con=0
ans,ans_2=0,0
for i in w:
    for j in s:
        if e*(i//100)<j:
            continue
        elif f<i+j:
            continue
        else:
            con=(100*j)/(i+j)
            if max_con<=con:
                max_con=con
                ans=i+j
                ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=s=[]
from fractions import Fraction
import math
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if 0<x and x<=f:
            w.append(x)
w=list(set(w))

for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if 0<y and y<=f:
            s.append(y)
s=list(set(s))
s.sort()
ans=ans_2=0
con=1
for i in w:
    for j in s:
        if i+j<=f and j<=e*(i//100):
            max_con=Fraction(100*j,i+j)
            if con<=max_con:
                con=max_con
                ans=i+j
                ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=s=[]
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
for i in range(0,f//100+1):
    for j in range(0,f//100+1):
        x=i*a*100+j*b*100
        if x<=f:
            w.append(x)
max_con=0
ans=ans_2=0
for i in w:
    for j in s:
        if i==0 and j==0:
            continue
        elif e*(i//100)<j:
            continue
        elif i+j>f:
            continue
        else:
            con=(100*j)/(i+j)
            if max_con<=con:
                max_con=con
                ans=i+j
                ans_2=j
print("{} {}".format(ans,ans_2))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=s=[]
from fractions import Fraction
import math
for i in range(math.ceil(f/a)):
    for j in range(math.ceil(f/b)):
        x=100*a*i+100*b*j
        if 0<x and x<=f:
            w.append(x)
w=list(set(w))

for i in range(math.ceil(f/c)):
    for j in range(math.ceil(f/d)):
        y=i*c+j*d
        if 0<y and y<=f:
            s.append(y)
s=list(set(s))
s.sort()
ans=ans_2=0
con=1
for i in w:
    for j in s:
        if i+j<=f and j<=e*(i//100):
            max_con=Fraction=100*j/(i+j)
            if con<max_con:
                con=max_con
                ans=i+j
                ans_2=j
print("{} {}".format(ans,ans_2))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=s=[]
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
for i in range(f//100+1):
    for j in range(f//100+1):
        x=i*a*100+j*b*100
        if x<=f:
            w.append(x)
max_con=0
ans=ans_2=0
for i in w:
    for j in s:
        if i==0 and j==0:
            continue
        elif e*(i//100)<j:
            continue
        elif f<i+j:
            continue
        else:
            con=(100*j)/(i+j)
            if max_con<con:
                max_con=con
                ans=i+j
                ans_2=j
print(ans,ans_2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w=s=[]
for i in range(f//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*b*j
        if x<=f:
            w.append(x)
for i in range(f):
    for j in range(f):
        y=i*c+j*d
        if y<=f:
            s.append(y)
max_con=0
ans=ans_2=0
for i in w:
    for j in s:
        if i==0 and j==0:
            continue
        elif e*(i//100)<j:
            continue
        elif f<i+j:
            continue
        else:
            con=(100*j)/(i+j)
            if max_con<con:
                max_con=con
                ans=i+j
                ans_2=j
print(ans,ans_2)