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())

n = 30

noudo = 0
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int(i*e/c)+1):
        d_num = (i*e - j*c) // d
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False

if all_s == 0:
    print(100*a,0)
    exit()

print(all_s,sato_s)

Submission status: Wrong Answer

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

n = 30

noudo = 0
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    print(i)
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int(i*e/c)+1):
        d_num = (i*e - j*c) // d
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False

if all_s == 0:
    print(100*a,0)
    exit()

print(all_s,sato_s)

Submission status: Wrong Answer

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

n = 30

noudo = 0
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int(i*e/c)+1):
        d_num = (i*e - j*c) // d
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False
            
print(all_s,sato_s)

Submission status: Wrong Answer

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

A *= 100
B *= 100

M = 0
Mwater, Msugar = 0, 0
for a in range(0, F + 1, A) :
    for b in range(0, F - a + 1, B) :
        for c in range(0, F - a - b + 1, C) :
            for d in range(0, F - a - b - c + 1, D) :
                if a + b + c + d == 0 :
                    continue
                if c + d <= (a + b) * E // 100 :
                    if 100 * (c + d) / (a + b + c + d) > M :
                        M = 100 * (c + d) / (a + b + c + d)
                        Mwater = a + b
                        Msugar = c + d
                        
print(Mwater+Msugar, Msugar)

Submission status: Wrong Answer

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

A *= 100
B *= 100

M = 0
Mwater, Msugar = 0, 0
for a in range(0, F + 1, A) :
    for b in range(0, F - a + 1, B) :
        for c in range(0, F - a - b + 1, C) :
            for d in range(0, F - a - b - c + 1, D) :
                if a + b == 0 or c + d == 0 :
                    continue
                if c + d <= (a + b) * E // 100 :
                    if 100 * (c + d) / (a + b + c + d) > M :
                        M = 100 * (c + d) / (a + b + c + d)
                        Mwater = a + b
                        Msugar = c + d
                        
print(Mwater+Msugar, Msugar)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = 100 * na * A + 100 * nb * B

                # if not (any([na, nb]) and any([nc, nd])):
                    # continue
                if solvent == 0:
                    break

                if (solute + solvent) > F:
                    # print("exceeded")
                    break

                else:
                    # if (solvent/100) * E < solute:
                    if solvent/100 * E >= solute:
                    # print("exceeded2")
                    # break
                        strength = 100 * solute / (solute + solvent)
                        # print(strength, solvent+solute, solute)
                        if max_strength < strength:
                            max_strength = strength
                            max_solute = solute
                            max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = na * A + nb * B

                # if not (any([na, nb]) and any([nc, nd])):
                    # continue
                if solvent == 0:
                    break

                if (solute + solvent) > F:
                    # print("exceeded")
                    break

                else:
                    # if (solvent/100) * E < solute:
                    if solvent/100 * E >= solute:
                    # print("exceeded2")
                    # break
                        strength = 100 * float(solute) / (solute + solvent)
                        # print(strength, solvent+solute, solute)
                        if max_strength < strength:
                            max_strength = strength
                            max_solute = solute
                            max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = na * A + nb * B

                # if not (any([na, nb]) and any([nc, nd])):
                    # continue
                if solvent == 0:
                    break

                if (solute + solvent) > F:
                    # print("exceeded")
                    break

                if (solvent/100) * E < solute:
                    # print("exceeded2")
                    break

                strength = 100 * float(solute) / (solute + solvent)
                # print(strength, solvent+solute, solute)

                if max_strength < strength:
                    max_strength = strength
                    max_solute = solute
                    max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = na * A + nb * B

                if not (any([na, nb]) and any([nc, nd])):
                    continue

                if (solute + solvent) > F:
                    # print("exceeded")
                    break

                if (solvent/100) * E < solute:
                    # print("exceeded2")
                    break

                strength = 100 * float(solute) / (solute + solvent)
                # print(strength, solvent+solute, solute)

                if max_strength < strength:
                    max_strength = strength
                    max_solute = solute
                    max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = na * A + nb * B

                if not (any([na, nb]) and any([nc, nd])):
                    continue

                if (solute + solvent) > F:
                    # print("exceeded")
                    break

                if (solvent/100) * E < solute:
                    # print("exceeded2")
                    break

                strength = float(solute) / (solute + solvent)
                # print(strength, solvent+solute, solute)

                if max_strength < strength:
                    max_strength = strength
                    max_solute = solute
                    max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = na * A + nb * B

                if not (any([na, nb]) and any([nc, nd])):
                    break

                if (solute + solvent) > F:
                    # print("exceeded")
                    break

                if (solvent/100) * E < solute:
                    # print("exceeded2")
                    break

                strength = float(solute) / (solute + solvent)
                # print(strength, solvent+solute, solute)

                if max_strength < strength:
                    max_strength = strength
                    max_solute = solute
                    max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 31):
            for nd in range(0, 31):

                solute = nc * C + nd * D
                solvent = na * A + nb * B

                if not (any([na, nb]) and any([nc, nd])):
                    continue

                if solute + solvent > F:
                    # print("exceeded")
                    continue

                if (solvent)/100 * E < solute:
                    # print("exceeded2")
                    continue

                strength = float(solute) / (solute + solvent)
                # print(strength, solvent+solute, solute)

                if max_strength < strength:
                    max_strength = strength
                    max_solute = solute
                    max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 31):
            for nd in range(0, 31):

                if not (any([na, nb]) and any([nc, nd])):
                    continue

                if na * A + nb * B + nc * C + nd * D > F:
                    # print("exceeded")
                    continue
                if (na * A + nb * B)/100 * E < nc * C + nd * D:
                    # print("exceeded2")
                    continue

                strength = float(nc * C + nd * D) / (na * A + na * B + nc * C + nd * D)
                # print(strength)

                if max_strength < strength:
                    max_strength = strength
                    max_solute = nc * C + nd * D
                    max_solvent = na * A + nb * B + max_solute

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 31):
            for nd in range(0, 31):

                if not (any([na, nb]) and any([nc, nd])):
                    continue

                if na * A + nb * B + nc * C + nd * D > F:
                    # print("exceeded")
                    continue
                if (na * A + nb * B)/100 * E < nc * C + nd * D:
                    # print("exceeded2")
                    continue

                strength = float(nc * C + nd * D) / (na * A + na * B + nc * C + nd * D)
                # print(strength)

                if max_strength < strength:
                    max_strength = strength
                    max_solvent = na * A + nb * B
                    max_solute = nc * C + nd * D

print(max_solvent, max_solute)

Submission status: Wrong Answer

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

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 31):
            for nd in range(0, 31):

                if not (any([na, nb]) and any([nc, nd])):
                    continue

                if na * A + nb * B + nc * C + nd * D > F:
                    # print("exceeded")
                    continue
                if (na * A + nb * B)/100 * E < nc * C + nd * D:
                    # print("exceeded2")
                    continue

                strength = float(nc * C + nd * D) / (na * A + na * B + nc * C + nd * D)
                # print(strength)

                if max_strength < strength:
                    max_strength = strength
                    max_solvent = na * A + nb * B
                    max_solute = nc * C + nd * D

print(max_solvent, " ", max_solute)

Submission status: Wrong Answer

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j <= f ):
  while( 100*a*i + 100*b*j <= f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j <= f ):
  while( c*i + d*j <= f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    tmp_noudo = 100 * y[j] / (x[i] + y[j])
    if  tmp_noudo <= 100 * e / (100 + e) and (x[i] + y[j]) <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )

Submission status: Wrong Answer

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j < f ):
  while( 100*a*i + 100*b*j < f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j < f ):
  while( c*i + d*j < f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    tmp_noudo = 100 * y[j] / (x[i] + y[j])
    if  tmp_noudo <= 100 * e / (100 + e) and (x[i] + y[j]) <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )

Submission status: Wrong Answer

Solution code:
ope1,ope2,ope3,ope4,concent,capacity = map(int,input().split())
ope1 *= 100
ope2 *= 100
noudo = 0
check = 0
check_capacity = 0
result ="0 0"

for i in range(int(capacity / ope1)+1):
    for x in range(int( (capacity -(i*ope1)) /ope2 )+1):
        if i+x == 0:
            continue
        for y in range(int( (capacity -(i*ope1 +x*ope2)) /ope3)+1):
            for z in range( int( (capacity -(i*ope1 +x*ope2 +y*ope3) ) /ope4)+1):
                if y+z ==0:
                    continue
                check = (100 *(y*ope3 + z*ope4)) / ( i*ope1 + x*ope2 + y*ope3 + z*ope4)

                if check > noudo and ((i*ope1+x*ope2)/100)*concent>= y*ope3+z*ope4:
                    noudo = check
                    result = (str(i*ope1+x*ope2+y*ope3+z*ope4)+" "+str(y*ope3+z*ope4))
print(result)

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][0]) for _ in range(ps[0][1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]

# エントリーポイント
def main():
    A, B, C, D, E, F = input([[int], 6])

    def build(a, b, MAX):
        for block in b:
            a |= {block}
            for i in range(MAX - block):
                if i in a:
                    a |= {i + block}

    waters = set()
    build(waters, [A, B], F // 100)

    SUGAR_MAX = F // 100 * E + 1
    sugars = set()
    build(sugars, [C, D], SUGAR_MAX)
    sugars = [-INF] + sorted(sugars) + [INF]
    # print(sugars)
    # print(waters)
    max_rate = (0, 0, 0)
    for water in waters:
        i = bsr(sugars, water * E) - 1
        while F < sugars[i] + water * 100:
            i -= 1
        sugar = sugars[i]
        water *= 100
        if (water + sugar) <= F:
            max_rate = max(max_rate, (((sugar / (water + sugar)) * 100), water + sugar, sugar))
    print(*max_rate[1:])

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][0]) for _ in range(ps[0][1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]

# エントリーポイント
def main():
    A, B, C, D, E, F = input([[int], 6])

    def build(a, b, MAX):
        for block in b:
            a |= {block}
            for i in range(MAX - block):
                if i in a:
                    a |= {i + block}

    waters = set()
    build(waters, [A, B], F // 100)

    SUGAR_MAX = F // 100 * E + 1
    sugars = set()
    build(sugars, [C, D], SUGAR_MAX)
    sugars = [-INF] + sorted(sugars) + [INF]
    # print(sugars)
    # print(waters)
    max_rate = (0, 0, 0)
    for water in waters:
        sugar = sugars[bsr(sugars, water * E) - 1]
        water *= 100
        if (water + sugar) <= F:
            max_rate = max(max_rate, (((sugar / (water + sugar)) * 100), water + sugar, sugar))
    print(*max_rate[1:])

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
conc = 0
ans = (0, 0)
for a in range(0, F + 1, 100 * A):
    for b in range(0, F - a + 1, 100 * B):
        w = a + b
        if w == 0:
            continue
        for c in range(0, min(w * E // 100, F - w) + 1, C):
            d = min(w * E // 100 - c, F - w - c) // D * D
            s = c + d
            if conc < s / (w + s):
                conc = s / (w + s)
                ans = (w + s, s)
print(*ans)

Submission status: Wrong Answer

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j <= f ):
  while( 100*a*i + 100*b*j <= f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j <= f ):
  while( c*i + d*j <= f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    w = (x[i] + y[j])
    tmp_noudo = 100 * y[j] / w
    if  tmp_noudo <= 100 * e / (100 + e) and w <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )
        
      


#print( eki, satou)

Submission status: Wrong Answer

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j < f ):
  while( 100*a*i + 100*b*j < f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j < f ):
  while( c*i + d*j < f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    tmp_noudo = 100 * y[j] / (x[i] + y[j])
    if  tmp_noudo <= 100 * e / (100 + e) and (x[i] + y[j]) <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )
        
      


#print( eki, satou)

Submission status: Wrong Answer

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j < f ):
  while( 100*a*i + 100*b*j < f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j < f ):
  while( c*i + d*j < f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    tmp_noudo = 100 * y[j] / (x[i] + y[j])
    if  tmp_noudo <= 100 * e / (100 + e) and (x[i] + y[j]) < f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )

Submission status: Wrong Answer

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j < f ):
  while( 100*a*i + 100*b*j < f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j < f ):
  while( c*i + d*j < f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  if x[i] > f:
    break
  for j in range(len(y)):
    if x[i]+y[j] > f:
      break
    tmp_noudo = 100 * y[j] / (x[i] + y[j])
    if  tmp_noudo <= 100 * e / (100 + e):
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )
        
      


#print( eki, satou)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
mxc = 0
ans = (0,0)
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                w = 100*A*i + 100*B*j
                s = C*k + D*l
                if s > E*w/100 or w+s > F or w == 0:
                    break
                if 100*s/(s+w) > mxc:
                    mxc = 100*s/(s+w)
                    ans = (s+w,s)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
mxc = 0
ans = (0,0)
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                w = 100*A*i + 100*B*j
                s = C*k + D*l
                if s > E*w/100 or w+s > F or s+w == 0:
                    break
                if 100*s/(s+w) > mxc:
                    mxc = 100*s/(s+w)
                    ans = (s+w,s)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
mxc = 0
ans = (0,0)
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                w = 100*A*i + 100*B*j
                s = C*k + D*l
                if s > E/100*w or w+s > F or s+w == 0:
                    break
                if 100*s/(s+w) > mxc:
                    mxc = 100*s/(s+w)
                    ans = (s+w,s)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
mxc = 0
ans = ()
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                w = 100*A*i + 100*B*j
                s = C*k + D*l
                if s > E/100*w or w+s > F:
                    break
                if s+w != 0 and 100*s/(s+w) > mxc:
                    mxc = 100*s/(s+w)
                    ans = (s+w,s)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

A, B, C, D, E, F = list(map(int, sys.stdin.readline().split()))

waters = set()
for a, b in itertools.product(range(31), repeat=2):
    w = A * a * 100 + B * b * 100
    if w <= F:
        waters.add(w)
waters.remove(0)
waters = list(waters)
waters.sort()

dp = [0] * (F + 1)
dp[0] = 1
for i in range(F + 1):
    if i + C < len(dp):
        dp[i + C] |= dp[i]
    if i + D < len(dp):
        dp[i + D] |= dp[i]
sugars = [i for i, s in enumerate(dp) if s]
sugars.sort()

ans_w = waters[0]
ans_s = 0
msw = 0
s = 0
for w in waters:
    while s < len(sugars) and sugars[s] / w * 100 <= E and w + sugars[s] <= F:
        s += 1
    sw = sugars[s - 1] / (w + sugars[s - 1])
    if sw > msw:
        msw = sw
        ans_w = w
        ans_s = sugars[s - 1]
print(ans_w + ans_s, ans_s)

Submission status: Wrong Answer

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


cap = e / (100 + e)
max_noudo = 0
sugar_ans, water_ans = 0, 0
for i in range(f//(100*a)+1):
    for j in range((f - (100 * a * i)) // (100 * b) + 1):
        water = 100 * (i * a + j * b)
        for k in range(((i * a + j * b)*e)//c+1):
            for l in range(((i * a + j * b)*e - k*c)//d+1):
                sugar = k * c + l * d
                if f <= water + sugar or water == 0:
                    continue
                else:
                    noudo = sugar / (water + sugar)
                    if max_noudo <= noudo <= cap:
                        max_noudo = noudo
                        sugar_ans = sugar
                        water_ans = water
print(water_ans+sugar_ans, sugar_ans)

Submission status: Wrong Answer

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


cap = e / (100 + e)
max_noudo = 0
sugar_ans, water_ans = 0, 0
for i in range(f//(100*a)+1):
    for j in range((f - (100 * a * i)) // (100 * b) + 1):
        water = 100 * (i * a + j * b)
        for k in range(((i * a + j * b)*e)//c+1):
            for l in range(((i * a + j * b)*e - k*c)//d+1):
                sugar = k * c + l * d
                if f <= water + sugar or (water + sugar == 0):
                    continue
                else:
                    noudo = sugar / (water + sugar)
                    if max_noudo < noudo <= cap:
                        max_noudo = noudo
                        sugar_ans = sugar
                        water_ans = water
print(water_ans+sugar_ans, sugar_ans)

Submission status: Wrong Answer

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


cap = e / (100 + e)
max_noudo = 0
sugar_ans, water_ans = 0, 0
for i in range(f//(100*a) + 1):
    for j in range(f//(100*b) + 1):
        for k in range(31):
            for l in range(31):
                water = 100 * (i * a + j * b)
                sugar = k * c + l * d
                if f <= water + sugar or water + sugar == 0:
                    continue
                else:

                    noudo = sugar / (water + sugar)
                    if max_noudo < noudo <= cap:
                        max_noudo = noudo
                        sugar_ans = sugar
                        water_ans = water
print(water_ans+sugar_ans, sugar_ans)