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 = []
for i in range(A+1):
    for j in range(B+1):
        if (100*A*i + 100*B*j )< F and (A*i + B*j) > 0:
            water.append(100*A*i+100*B*j)

sugar = []
for i in range(C+1):
    for j in range(D+1):
        if C*i + D*j < F and (C*i + D*j) > 0:
            sugar.append(C*i+D*j)
            
water.sort()
sugar.sort()
    
MAX = 0
MAXSUGAR = 0
MAXWEIGHT = 0
tmpsugar = 0
for i in range(len(water)):
    for j in range(len(sugar)):
        tmpsugar = sugar[j]
        while (water[i]+tmpsugar)<=F and tmpsugar <= water[i]*E//100:
            if MAX  <= 100*tmpsugar/(water[i]+tmpsugar):
                MAX  = 100*tmpsugar/(water[i]+tmpsugar)
                MAXSUGAR = tmpsugar
                MAXWEIGHT = water[i]+tmpsugar
            tmpsugar += sugar[j]

print(str(MAXWEIGHT)+" "+str(MAXSUGAR))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, a = II(), II()
    print(n * n - a)
    return

#B
def B():
    _ = II()
    k = II()
    x = LI()
    ans = 0
    for xi in x:
        ans += min(xi, k - xi)
    print(ans * 2)
    return

#C
def C():
    a, b, c, d, e, F = LI()
    ans = [inf, 0]
    for ai in range(F // (100 * a) + 1):
        for bi in range((F - 100 * ai * a) // (100 * b) + 1):
            if ai == bi == 0:
                continue
            ab = ai * 100 * a + bi * 100 * b
            for ci in range((F - ab) // c + 1):
                for di in range((F - ab - ci * c) // d + 1):
                    if (ai * a + bi * b) * e < ci * c + di * d:
                        continue
                    if ans[1] / ans[0] < (ci * c + di * d) / (ab + ci * c + di * d):
                        ans = [ab + ci * c + di * d, ci * c + di * d]
    print(*ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
l_water=set()
for i in range(f//(a*100)+1):
    for j in range(f//(b*100)+1):
        tmp=i*a*100+j*b*100
        if 0<tmp<=f:l_water.add(tmp)
l_sugar=set()
max_s=max(l_water)//100*e
for i in range(max_s//c+1):
    for j in range(max_s//d+1):
        tmp=i*c+j*d
        if 0<=tmp<=max_s:l_sugar.add(tmp)
ans=[0,0,0]
for i in l_water:
    for j in l_sugar:
        if j<=i//100*e and i+j<=f:
            tmp=j/(i+j)
            if tmp>ans[0]:
                ans=[tmp,i+j,j]
print(*ans[1:])

Submission status: Wrong Answer

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


'''
1.ビーカーに用意できる水の量のパターンを計算する
2.そこに砂糖を溶かせるだけ溶かす
3.全量がびーかの容量以下で濃度が100%以下であるものを採用する
'''

#1.作れる水の量をリストに入れる
#容量の入れもの　+100は余裕分
l = [0 for i in range(31)]
#aの作業で実現できる水
for i in range(0,len(l),a):
    l[i] = i*100
#bも使っていい場合
for i in range(1,len(l),b):
    #bだけで実現できる
    if (i/b).is_integer():
        l[i] = i*100
#aとbで実現できる水の数
for i in range(a,len(l)-b,a):
    l[i+b] = i*100

suger = [0 for i in range(3001)]
#cの作業で実現できる砂糖
for i in range(0,len(suger),c):
    suger[i] = i
#dも使っていい場合
for i in range(1,len(suger)-d):
    #dだけで実現できる
    if i%d == 0:
        suger[i] = i
    #aとbで実現できる
    if suger[i] == i:
        suger[i+d] = (i+d)

#溶かせるだけ溶かして濃度比較
out_suger = 0
out_l = 0
conce = 0

for i in range(f//100+1):
    for j in reversed(range(3001)):
        #作れない or 溶き切らない場合飛ばす
        if suger[j] == 0 or suger[j] > e*l[i]/100:
            continue
        #濃度が最大でand容量を超えていない
        elif conce < (suger[j]*100/(suger[j]+l[i])) and f >=(suger[j]+l[i]):
            conce = (suger[j]*100/(suger[j]+l[i]))            
            out_l = suger[j]+l[i]
            out_suger =suger[j]
            break

print(out_l,out_suger)
        


        
#print(l)
#print(suger)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#ABC74 C

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

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
water = []
suger = []
for A in range(s+1):
    for B in range(t+1):
        if 100*a*A + 100*b*B != 0:
            water.append(100*a*A + 100*b*B)

for C in range(u+1):
    for D in range(v+1):
        suger.append(c*C + d*D)

ans1 = 0
ans2 = 0
for W in water:
    for S in suger:
        if W + S <= f:
            if W//100*e >= S:
                if concentration < S/(W+S):
                    concentration = S/(W+S)
                    ans1 = W+S
                    ans2 = S
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#ABC74 C

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

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1)[::-1]:
    for B in range(t+1)[::-1]:
        for C in range(u+1)[::-1]:
            for D in range(v+1)[::-1]:
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
print(solution,suger)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#ABC74 C

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

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
print(solution,suger)

Submission status: Wrong Answer

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


'''
1.ビーカーに用意できる水の量のパターンを計算する
2.そこに砂糖を溶かせるだけ溶かす
3.全量がびーかの容量以下で濃度が100%以下であるものを採用する
'''

#1.作れる水の量をリストに入れる
#容量の入れもの　+100は余裕分
l = [0 for i in range(31)]
#aの作業で実現できる水
for i in range(0,len(l),a):
    l[i] = i*100
#bも使っていい場合
for i in range(1,len(l),b):
    #bだけで実現できる
    if (i/b).is_integer():
        l[i] = i*100
#aとbで実現できる
for i in range(a,len(l)-b,a):
    l[i] = i*100



suger = [0 for i in range(3001)]
#cの作業で実現できる砂糖
for i in range(0,len(suger),c):
    suger[i] = i
#dも使っていい場合
for i in range(1,len(suger)-d):
    #dだけで実現できる
    if i%d == 0:
        suger[i] = i
    #aとbで実現できる
    if suger[i] == i:
        suger[i+d] = (i+d)

#溶かせるだけ溶かして濃度比較
out_suger = 0
out_l = 0
conce = 0

for i in range(f//100+1):
    for j in reversed(range(3001)):
        #作れない or 溶き切らない場合飛ばす
        if suger[j] == 0 or suger[j] > e*l[i]/100:
            continue
        #濃度が最大でand容量を超えていない
        elif conce < (suger[j]*100/(suger[j]+l[i])) and f >=(suger[j]+l[i]):
            conce = (suger[j]*100/(suger[j]+l[i]))            
            out_l = suger[j]+l[i]
            out_suger =suger[j]
            break

print(out_l,out_suger)
        


        
#print(l)
#print(suger)

Submission status: Wrong Answer

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


'''
1.ビーカーに用意できる水の量のパターンを計算する
2.そこに砂糖を溶かせるだけ溶かす
3.全量がびーかの容量以下で濃度が100%以下であるものを採用する
'''

#1.作れる水の量をリストに入れる
#容量の入れもの　+100は余裕分
l = [0 for i in range(31)]
#aの作業で実現できる水
for i in range(0,len(l),a):
    l[i] = i*100
#bも使っていい場合
for i in range(1,len(l),b):
    #bだけで実現できる
    if (i/b).is_integer():
        l[i] = i*100
#aとbで実現できる
for i in range(a,len(l)-b,a):
    l[i] = i*100



suger = [0 for i in range(3001)]
#cの作業で実現できる砂糖
for i in range(0,len(suger),c):
    suger[i] = i
#dも使っていい場合
for i in range(1,len(suger)-d):
    #dだけで実現できる
    if i%d == 0:
        suger[i] = i
    #aとbで実現できる
    if suger[i] == i:
        suger[i+d] = (i+d)

#溶かせるだけ溶かして濃度比較
out_suger = 0
out_l = 0
conce = 0

for i in range(31):
    for j in reversed(range(3001)):
        #作れない or 溶き切らない場合飛ばす
        if suger[j] == 0 or suger[j] > e*l[i]/100:
            continue
        elif conce < (suger[j]*100/(suger[j]+l[i])) and f >=(suger[j]+l[i]):
            out_l = suger[j]+l[i]
            out_suger =suger[j]
            break

print(out_l,out_suger)
        


        
#print(l)
#print(suger)

Submission status: Wrong Answer

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

d_max = 0
water = []
sugar = []
water_max = 0
sugar_max = 0
for i in range(int(f / (100 * a)) + 2):
    for j in range(int(f / (100 * b)) + 2):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)

for i in range(int(f / c) + 2):
    for j in range(int(f / d) + 2):
        if c * i + d * j <= f:
            sugar.append(c * i + d * j)

for w in water:
    for s in sugar:
        if s <= w / 100 * e and w + s <= f:
            if w + s == 0:
                d = 0
            else:
                d = 100 * s / (w + s)
            if d > d_max:
                d_max = d
                water_max = w
                sugar_max = s

print(' '.join([str(water_max + sugar_max), str(sugar_max)]))

Submission status: Wrong Answer

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

d_max = 0
water = []
sugar = []
water_max = 0
sugar_max = 0
for i in range(int(f / (100 * a)) + 1):
    for j in range(int(f / (100 * b)) + 1):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)

for i in range(int(f / c) + 1):
    for j in range(int(f / d) + 1):
        if c * i + d * j <= f:
            sugar.append(c * i + d * j)

for w in water:
    for s in sugar:
        if s <= w / 100 * e and w + s <= f:
            if w + s == 0:
                d = 0
            else:
                d = 100 * s / (w + s)
            if d > d_max:
                d_max = d
                water_max = w
                sugar_max = s

print(' '.join([str(water_max + sugar_max), str(sugar_max)]))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
w=set()
for i in range(0,f+1,100*a):
    for j in range(0,f+1-i,100*b):
        i=i+j
        w.add(i)
s=set()
for i in range(0,f+1,c):
    for j in range(0,f+1-i,d):
        i=i+j
        s.add(i)
ans=0
sugerwater = 0
suger = 0
for x in w:
    for y in s:
        if 0<x+y<=f and y<=x*e/100:
            if ans< y/(x+y):
                ans = y/(x+y)
                sugerwater = x+y
                suger = y
print(sugerwater,suger)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
wl = set()
for ia in range(F//A+1):
    for ib in range(F//B+1):
        ww = ia*A*100+ib*B*100
        if 0 < ww <= F:wl.add(ww)

ws = set()
for ic in range((F*E)//(100*C) + 1):
    for idd in range((F*E)//(100*D)+1):
        ss = ic*C + idd*D
        if ss <= (F*E)/100:ws.add(ss)

g = 0
sw = sg = 0
for www in sorted(wl):
    ms = (www * E) // 100
    for c in sorted(ws):
        if c > ms:break
        else:
            if (c/www) <= E and (www+c) <=F:
                if g < c/(c+www):
                    g = c/(c+www)
                    sw = www
                    sg = c
print(sg+sw,sg)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
mizu = []
satou = []
tmp_ans = []
ans = 0
ans_i = 0
ans_j = 0
for i in range(31):
    for j in range(31):
        tmp = a * 100 * i + b * 100 * j
        if tmp <= f:
            mizu.append(tmp)
mizu = list(set(mizu))
for i in range(101):
    for j in range(101):
        tmp = c * i + d * j
        if tmp <= f:
            satou.append(tmp)
satou = list(set(satou))
for i in mizu:
    for j in satou:
        if i + j <= f:
            if i + j != 0 and i != 0 and i // 100 * e >= j:
                if ans < j /(i + j):
                    ans = j / (i + j)
                    ans_i = i
                    ans_j =j
print(ans_i + ans_j,ans_j)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
mizu = []
satou = []
tmp_ans = []
ans = 0
ans_i = 0
ans_j = 0
for i in range(31):
    for j in range(31):
        tmp = a * 100 * i + b * 100 * j
        if tmp <= f:
            mizu.append(tmp)
mizu = list(set(mizu))
for i in range(101):
    for j in range(101):
        tmp = c * i + d * j
        if tmp <= e:
            satou.append(tmp)
satou = list(set(satou))
for i in mizu:
    for j in satou:
        if i + j <= f:
            if i + j != 0 and i != 0:
                if ans < j /(i + j):
                    ans = j / (i + j)
                    ans_i = i
                    ans_j =j
print(ans_i + ans_j,ans_j)

Submission status: Wrong Answer

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

water = []
for i in range(32):
    if 100 * A * i > F:
        continue
    for j in range(32):
        if 100 * A * i + 100 * B * j > F:
            continue
        if i == 0 and j == 0:
            continue
        water.append(100 * A * i + 100 * B * j)

sugar = [0] * (F * F)
for i in range(F):
    if i * C > F:
        continue
    for j in range(F):
        if i * C + j * D > F:
            continue
        sugar.append(C * i + D * j)
sugar = list(set(sugar))

water.sort()
sugar.sort()
ans = 0
wa = 0
su = 0
for i in water:
    for j in sugar:
        if i + j <= F:
            if ans < (100 * j / (i + j)) and (i / 100 * E) >= j:
                ans = (100 * j / (i + j))
                wa = i
                su = j

print(wa + su, su)

Submission status: Wrong Answer

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

water = []
for i in range(32):
    if 100 * A * i > F:
        continue
    for j in range(32):
        if 100 * A * i + 100 * B * j > F:
            continue
        if i == 0 and j == 0:
            continue
        water.append(100 * A * i + 100 * B * j)

sugar = [0] * (F * F)
for i in range(F):
    if i * C > F:
        continue
    for j in range(F):
        if i * C + j * D > F:
            continue
        sugar.append(C * i + D * j)
sugar = list(set(sugar))

water.sort()
sugar.sort()
ans = 0
wa = 0
su = 0
for i in water:
    for j in sugar:
        if i + j <= F:
            if ans < (j / (i + j)) and (i / 100 * E) >= j:
                ans = (j / (i + j))
                wa = i
                su = j

print(wa + su, su)

Submission status: Wrong Answer

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

water = []
for i in range(31):
    if 100 * A * i > F:
        continue
    for j in range(31):
        if 100 * A * i + 100 * B * j > F:
            continue
        if i == 0 and j == 0:
            continue
        water.append(100 * A * i + 100 * B * j)

sugar = [0] * (F * F)
for i in range(F):
    if i * C > F:
        continue
    for j in range(F):
        if i * C + j * D > F:
            continue
        sugar.append(C * i + D * j)
sugar = list(set(sugar))

water.sort()
sugar.sort()
ans = 0
wa = 0
su = 0
for i in water:
    for j in sugar:
        if i + j <= F:
            if ans < (j / (i + j)) and (i / 100 * E) >= j:
                ans = (j / (i + j))
                wa = i
                su = j

print(wa + su, su)

Submission status: Wrong Answer

Solution code:
a ,b ,c ,d ,e ,f = map(int,input().split())
water = set()
sugar = set()
cou = 0
co = 0

for i in range(f//b):
    cou = 0
    while 100 * b * i + 100 * a * cou <= f:
        water.add(100 * b * i + 100 * a * cou)
        cou += 1
water = sorted(water)
print(water)

for i in range(f//d):
    cow = 0
    while d * i + c * cow <= f:
        sugar.add(d * i + c * cow)
        cow += 1
sugar = sorted(sugar)
print(sugar)



ans = [0,0,0]

for wat in water:
    for sug in sugar:
        if wat or sug:
            if wat + sug <= f and e / (100 + e) >= sug/(wat+sug):
                if ans[0] <= sug/(wat+sug):
                    ans = [sug/(wat+sug), wat+sug, sug]
print(ans[1],ans[2])

Submission status: Wrong Answer

Solution code:

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

amax = F // (100 * A)
bmax = F // (100 * B)
cmax = F // C
dmax = F // D

ans = 0
summ = 0
suge = 0


for a in range(amax+1):

    for b in range(bmax+1):

        for c in range(cmax+1):

            for d in range(dmax+1):


                if 100*A*a + 100*B*b + C*c + D*d <= F and (A*100*a+B*100*b)*E >= 100*(C*c+D*d):

                    if A*100*a+B*100*b+C*c+D*d !=0 and ans < 100*(C*c+D*d)/(A*100*a+B*100*b+C*c+D*d):

                        ans = 100*(C*c+D*d)/(A*100*a+B*100*b+C*c+D*d)
                        summ = A*100*a+B*100*b+C*c+D*d
                        suge = C*c+D*d

print (summ,suge)

Submission status: Wrong Answer

Solution code:
row = list(map(int, input().split()))
max_water= 0
max_sugar = 0
max_percent = 0
#print(int(row[5]/(row[0]*100))+1)
for w1 in range(int(row[5]/(row[0]*100))+1):
    for w2 in range(int((row[5]-w1*100*row[0])/(row[1]*100))+1):
        for s1 in range(int((row[5]-w1*100*row[0]-w2*row[1]*100)/row[2])+1):
            for s2 in range(int((row[5]-w1*100*row[0]-w2*row[1]*100-s1*row[2])/row[3])+1):
                water = w1*100*row[0]+w2*row[1]*100
                sugar = s1*row[2]+s2*row[3]
                #print(w1, w2, s1, s2)
                if sugar + water != 0 and water != 0:
                    percent = 100*sugar/(water + sugar)
                    if max_percent < percent <= 100*row[4]/(100+row[4]):
                        max_water = water
                        max_sugar = sugar
                        max_percent = percent

print(max_water+max_sugar, max_sugar)

Submission status: Wrong Answer

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

mini = min(A, B)*100

s_mini = min(C, D)

nokori = F - mini

N = nokori//s_mini
b = s_mini * N
for i in range(N):
    if 100 >= 100*b/(mini+b):
        break
    else:
        b = b - s_mini


ans = [mini+b, b]

print(*ans)

Submission status: Wrong Answer

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

maxStrength = 0
ansMass = 0
ansSugar = 0
for i in range(0, F+1, 100*A):
        for j in range(0, F-(i//100)+1, 100*B):
                for k in range(0, F-(i//(100*A))-(j//(100*B))+1, C):
                        for l in range(0, F-(i//(100*A))-(j//(100*B))-(k//C)+1, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a / 100)*E >= b and mass <= F and mass != 0:
                                        strength = (100*b) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSugar = b

print(ansMass, ansSugar)

Submission status: Wrong Answer

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

maxStrength = 0
ansMass = 0
ansSugar = 0
for i in range(0, F+1, 100*A):
        for j in range(0, F-i+1, 100*B):
                for k in range(0, F-i-j+1, C):
                        for l in range(0, F-i-j-k+1, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a / 100)*E >= b and mass <= F and mass != 0:
                                        strength = (100*b) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSugar = b

print(ansMass, ansSugar)

Submission status: Wrong Answer

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

maxStrength = 0
ansMass = 0
ansSugar = 0
for i in range(0, F, 100*A):
        for j in range(0, F-i, 100*B):
                for k in range(0, F-i-j, C):
                        for l in range(0, F-i-j-k, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a / 100)*E >= b and mass <= F and mass != 0:
                                        strength = (100*b) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSugar = b

print(ansMass, ansSugar)

Submission status: Wrong Answer

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

maxStrength = 0
ansMass = 0
ansSuger = 0
for i in range(0, F, 100*A):
        for j in range(0, F-i, 100*B):
                for k in range(0, F-i-j, C):
                        for l in range(0, F-i-j-k, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a // 100)*E > b and mass <= F and mass != 0:
                                        strength = (100*(k+l)) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSuger = k+l

print(ansMass, ansSuger)

Submission status: Wrong Answer

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

i=0
mizu=[]
while a*i*100<=f:
    j=0
    while b*j*100<=f:
        if a*i+b*j!=0 and (not (a*i+b*j)*100 in mizu):
            mizu.append((a*i+b*j)*100)
        j+=1
    i+=1

# print(mizu)

i=0
sato=[]
while c*i<=f:
    j=0
    while d*j<=f:
        if not c*i+d*j in sato:
            sato.append(c*i+d*j)
        j+=1
    i+=1
# print(sato)

ans=[0,1]
for i in range(len(mizu)):
    for j in range(len(sato)):
        if sato[j]+mizu[i]<=f and sato[j]*100<=e*mizu[i]:
            if ans[0]/(ans[0]+ans[1])<sato[j]/(mizu[i]+sato[j]):
                ans=[sato[j], mizu[i]]

print("{0} {1}".format(ans[0]+ans[1], ans[0]))

Submission status: Wrong Answer

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

i=0
mizu=[]
while a*i*100<=f:
    j=0
    while (a*i+b*j)*100<=f:
        if a*i+b*j!=0 and (not (a*i+b*j)*100 in mizu):
            mizu.append((a*i+b*j)*100)
        j+=1
    i+=1

# print(mizu)

i=0
sato=[]
while c*i<=f:
    j=0
    while c*i+d*j<=f:
        if not c*i+d*j in sato:
            sato.append(c*i+d*j)
        j+=1
    i+=1
# print(sato)

ans=[0,1]
for i in range(len(mizu)):
    for j in range(len(sato)):
        if sato[j]+mizu[i]<=f and sato[j]*100<=e*mizu[i]:
            if ans[0]/(ans[0]+ans[1])<sato[j]/(mizu[i]+sato[j]):
                ans=[sato[j], mizu[i]]

print("{0} {1}".format(ans[0]+ans[1], ans[0]))

Submission status: Wrong Answer

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

i=0
mizu=[]
while a*i*100<=f:
    j=0
    while (a*i+b*j)*100<=f:
        if a*i+b*j!=0 and (not (a*i+b*j)*100 in mizu):
            mizu.append((a*i+b*j)*100)
        j+=1
    i+=1

# print(mizu)

i=0
sato=[]
while c*i<=f:
    j=0
    while c*i+d*j<=f:
        if not c*i+d*j in sato:
            sato.append(c*i+d*j)
        j+=1
    i+=1
# print(sato)

ans=[0,1]
for i in range(len(mizu)):
    for j in range(len(sato)):
        if sato[j]+mizu[i]<=f and sato[j]*100/mizu[i]<=e:
            if ans[0]/(ans[0]+ans[1])<sato[j]/(mizu[i]+sato[j]):
                ans=[sato[j], mizu[i]]

print("{0} {1}".format(ans[0]+ans[1], ans[0]))

Submission status: Wrong Answer

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

i=0
mizu=[]
while a*i*100<=f:
    j=0
    while (a*i+b*j)*100<=f:
        if a*i+b*j!=0 and (not (a*i+b*j)*100 in mizu):
            mizu.append((a*i+b*j)*100)
        j+=1
    i+=1

print(mizu)

i=0
sato=[]
while c*i<=f:
    j=0
    while c*i+d*j<=f:
        if not c*i+d*j in sato:
            sato.append(c*i+d*j)
        j+=1
    i+=1
print(sato)

ans=[0,1]
for i in range(len(mizu)):
    for j in range(len(sato)):
        if sato[j]+mizu[i]<=f and sato[j]*100/mizu[i]<=e:
            if ans[0]/(ans[0]+ans[1])<sato[j]/(mizu[i]+sato[j]):
                ans=[sato[j], mizu[i]]

print("{0} {1}".format(ans[0]+ans[1], ans[0]))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=A*100
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(water,sugar)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=100
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(water,sugar)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=0
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(str(water)+' '+str(sugar))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=0
sugar=0
while cnt_A*100*A < F:
  cnt_B=0
  while cnt_B*100*B < F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C < F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D < F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(str(water)+' '+str(sugar))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=0
sugar=0
while cnt_A*100*A < F:
  cnt_B=0
  while cnt_B*100*B < F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C < F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D < F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E > cnt_C*C+cnt_D*D:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(str(water)+' '+str(sugar))