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

max_concentration = 0
best_water = 0
best_sugar = 0

for i in range(A + 1) :
    for j in range(B + 1) :
        if i == j == 0 :
            continue
            
        max_sugar = min(F - i * A - j * B, (i * A + j * B) * E)
        for k in range(C + 1) :
            available_sugar = max_sugar - k * C if max_sugar - k * C >= 0 else 0

            l  = available_sugar // D
            
            mass_water = i * A * 100 + j * B * 100
            mass_sugar = k * C + l * D
            total_content = mass_water + mass_sugar
            concentration = mass_sugar / total_content
            
            if total_content <= F and max_sugar >= mass_sugar and concentration >= max_concentration :
                best_water = mass_water
                best_sugar = mass_sugar
                max_concentration = concentration

if best_water == best_sugar == 0 :
    print(min(A, B) * 100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
best_water = 0
best_sugar = 0

for i in range(A + 1) :
    for j in range(B + 1) :
        if i == j == 0 :
            continue
            
        max_sugar = (i * A + j * B) * E
        for k in range(C + 1) :
            available_sugar = max_sugar - k * C if max_sugar - k * C >= 0 else 0

            l  = available_sugar // D
            
            mass_water = i * A * 100 + j * B * 100
            mass_sugar = k * C + l * D
            total_content = mass_water + mass_sugar
            concentration = mass_sugar / total_content
            
            if total_content <= F and max_sugar >= mass_sugar and concentration >= max_concentration :
                best_water = mass_water
                best_sugar = mass_sugar
                max_concentration = concentration

if best_water == best_sugar == 0 :
    print(min(A, B) * 100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
best_water = 0
best_sugar = 0

for i in range(A + 1) :
    for j in range(B + 1) :
        if i == j == 0 :
            continue
            
        max_sugar = (i * A + j * B) * E
        for k in range(C + 1) :
            available_sugar = max_sugar - k * C if max_sugar - k * C >= 0 else 0

            l  = available_sugar // D
            
            mass_water = i * A * 100 + j * B * 100
            mass_sugar = k * C + l * D
            total_content = mass_water + mass_sugar
            concentration = mass_sugar / total_content
            
            if total_content <= F and max_sugar >= mass_sugar and concentration >= max_concentration :
                best_water = mass_water
                best_sugar = mass_sugar
                max_concentration = concentration
                
print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 2) :
    for j in range(F//(B * 100) + 2) :
        for k in range(((i*A + j*B) * E) // C + 2) :
            l = ((i * A + j * B) * E - k*C) // D
            if not(i==j==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
if max_dil == 0 :
    print(min(A*i, B*i)*100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            l = ((i * A + j * B) * E - k*C) // D
            if not(i==j==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
if max_dil == 0 :
    print(min(A*i, B*i)*100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            l = ((i * A + j * B) * E - k*C) // D
                # if (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
            if not(i==j==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil <= (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
if max_dil == 0 :
    print(min(A*i, B*i)*100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            l = ((i * A + j * B) * E - k*C) // D
                # if (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
            if not(i==j==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
if max_dil == 0 :
    print(min(A*i, B*i)*100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            l = ((i * A + j * B) * E - k*C) // D
                # if (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
            if not(i==j==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
if max_dil == 0 :
    print(max(A*i, B*i)*100, 0)
else :
    print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            l = ((i * A + j * B) * E - k*C) // D
                # if (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
            if not(i==j==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            l = ((i * A + j * B) * E - k*C) // D
                # if (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
            if not(i==j==k==l==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                best_water = i*A*100 + j*B*100
                best_sugar = k*C + l*D
                    
print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

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

max_dil = 0
best_water = 0
best_sugar = 0

for i in range(F//(A * 100) + 1) :
    for j in range(F//(B * 100) + 1) :
        for k in range(((i*A + j*B) * E) // C + 1) :
            for l in range(((i*A + j*B) * E - k*C) // D + 1) :
                # if (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                if not(i==j==k==l==0) and (k*C + l*D + i*A*100 + j*B*100) <= F and max_dil < (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100) :
                    max_dil = (100 * (k*C + l*D)) / (k*C + l*D + i*A*100 + j*B*100)
                    best_water = i*A*100 + j*B*100
                    best_sugar = k*C + l*D
                    
print(best_water + best_sugar, best_sugar)

Submission status: Wrong Answer

Solution code:
import math

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

max_b = math.floor(F/(100*B))

W=[]

for i in range(max_b):
    water=i*100*B
    while water<=F:
        if water!=0:
            W.append(water)
        water+=A*100

W=list(set(W))
W.sort()

ans=[0,0,0]

for i in W:
    max_s=(i*E)//100
    if max_s+i>F:
        max_s=F-i
    max_num=math.floor(max_s/D)
    max_cd=max_num*D
    for j in range(max_num,-1,-1):  
        max_c=math.floor((max_s-j*D)/C)
        if max_cd<max_c*C+j*D:
            max_cd=max_c*C+j*D
    no=max_cd/(max_cd+i)
    if no>ans[0] and max_cd+i <=F:
        ans=[no,max_cd+i,max_cd]

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

Submission status: Wrong Answer

Solution code:
import math

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

max_b = math.floor(F/(100*B))

W=[]

for i in range(max_b):
    water=i*100*B
    a_c=1
    while water<=F:
        if water!=0:
            W.append(water)
        water+=a_c*A*100

W=list(set(W))
W.sort()

ans=[0,0,0]

for i in W:
    max_s=i*E//100
    max_num=math.floor(max_s/D)
    max_cd=max_num*D
    for j in range(max_num,-1,-1):
        max_c=math.floor((max_s-j*D)/C)
        if max_cd<max_c*C+j*D:
            max_cd=max_c*C+j*D
    no=max_cd/(max_cd+i)
    if no>ans[0] and max_cd+i <=F:
        ans=[no,max_cd+i,max_cd]

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

Submission status: Wrong Answer

Solution code:
import math

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

max_b = math.floor(F/(100*B))

W=[]

for i in range(max_b):
    water=i*100*B
    a_c=1
    while water<=F:
        if water!=0:
            W.append(water)
        water+=a_c*A*100

W=list(set(W))
W.sort()

ans=[0,0,0]

for i in W:
    max_s=i*E//100
    max_num=math.floor(max_s/D)
    max_cd=max_num*D
    for j in range(max_num,-1,-1):
        max_c=math.floor((max_s-j*D)/C)
        if max_cd<max_c*C+j*D:
            max_cd=max_c*C+j*D
    no=max_cd/(max_cd+i)
    if no>ans[0]:
        ans=[no,max_cd+i,max_cd]

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

Submission status: Wrong Answer

Solution code:
import math

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

max_b = math.floor(F/(100*B))

W=[]

for i in range(max_b):
    water=i*100*B
    a_c=1
    while water<=F:
        if water!=0:
            W.append(water)
        water+=a_c*A*100

W=list(set(W))
W.sort()

ans=[0,0,0]

for i in W:
    max_s=i*E//100
    max_num=math.floor(max_s/D)
    max_cd=max_num*D
    for j in range(max_num,-1,-1):
        max_c=math.floor((max_s-j*D)/C)
        if max_cd<max_c*C+j*D:
            max_cd=max_c*C+j*D
    no=max_cd/(max_cd+i)
    if no>ans[0]:
        ans=[no,max_cd+i,max_cd]

print(ans[1:3])

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
#100*A*i + 200*B*j == x
#C*i + D*j == y
xs = []
ys = []
def dens(x,y):
    if x+y==0:
        return(-1)
    else:
        return(y/(x+y))
for i in range(31):
    for j in range(16):
        if 100*A*i + 200*B*j <= F:
            xs.append(100*A*i + 200*B*j)
for i in range(3001):
    for j in range(1501):
        if C*i + D*j <= F:
            ys.append(C*i + D*j)
density = 0
water = xs[0]
sugar = ys[0]
for x in xs:
    for y in ys:
        if x+y > F or 100*y > E*x:
            continue
        nd = dens(x,y)
        if nd > density:
            density = nd
            sugar = y
            water = x
            #print([sugar,water,density])
print(str(water+sugar) + " " + str(sugar))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=list(map(int,input().split()))
sws=[]
mxsg=0
mxval=0,0
for a in range(F//(A*100)+1):
    for b in range((F-a*A*100)//(B*100)+1):
        rest=F-A*a*100-B*b*100
        for c in range(rest//C+1):
            rest2=(A*a+b*B)*E-c*C
            if rest2<0:continue
            d=max(0,min(rest2//D, (F-(A*a+b*B)-C*c)//D))
            sgw,sg = (a*A+b*B)*100+c*C+d*D,c*C+d*D
            if sgw==0 or sgw > F:continue
            if sg/sgw > mxsg:
                mxsg = sg/sgw
                mxval = sgw,sg
print("{} {}".format(*mxval))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=list(map(int,input().split()))
sws=[]
mxsg=0
mxval=0,0
for a in range(F//(A*100)+1):
    for b in range((F-a*A*100)//(B*100)+1):
        rest=F-A*a*100-B*b*100
        maxSugar = (A*a+B*b)*E
        for c in range(min(rest//C,maxSugar//C)+1):
            d=max(0,min((rest-c*C)//D,(maxSugar-c*C)//D))
            sgw,sg = (a*A+b*B)*100+c*C+d*D,c*C+d*D
            if sgw==0 or sgw > F:continue
            if sg/sgw > mxsg:
                mxsg = sg/sgw
                mxval = sgw,sg
print("{} {}".format(*mxval))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=list(map(int,input().split()))
sws=[]
mxsg=0
mxval=0,0
for a in range(F//(A*100)+1):
    for b in range((F-a*A*100)//(B*100)+1):
        rest=F-A*a*100-B*b*100
        maxSugar = (A*a+B*b)*E
        for c in range(min(rest//C,maxSugar//C)+1):
            d=max(0,min((rest-c*C)//D,(maxSugar-c*C)//D))
            sgw,sg = (a*A+b*B)*100+c*C+d*D,c*C+d*D
            if sgw==0:continue
            if sg/sgw > mxsg:
                mxsg = sg/sgw
                mxval = sgw,sg
print("{} {}".format(*mxval))

Submission status: Wrong Answer

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

temp = 0
ans1, ans2 = 100, 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 w == 0:
                    break
                if s > E * (A * i + B * j):
                    break
                if w + s > F:
                    break
                if s / (w + s) > temp:
                    temp = s / (w + s)
                    ans1 = w + s
                    ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

temp = 0
ans1, ans2 = 1, 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 w == 0:
                    break
                if s > E * (A * i + B * j):
                    break
                if w + s > F:
                    break
                if s / (w + s) > temp:
                    temp = s / (w + s)
                    ans1 = w + s
                    ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

temp = 0
ans1, ans2 = 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 w == 0:
                    break
                if s > E * (A * i + B * j):
                    break
                if w + s > F:
                    break
                if s / (w + s) > temp:
                    temp = s / (w + s)
                    ans1 = w + s
                    ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

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

temp = 0
ans1, ans2 = 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 w == 0:
                    break
                if s > E * w:
                    break
                if w + s > F:
                    break
                if s / (w + s) > temp:
                    temp = s / (w + s)
                    ans1 = w + s
                    ans2 = s

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = [int(_) for _ in input().split()]

maxr = 0
result = 0, 0

for a in range(31):
    for b in range(31):
        l = 100 * a * A + 100 * b * B
        if l <= F:
            maxs100 = E * l
            d = 0
            while d * D * 100 <= maxs100:
                c = (maxs100 - d * D * 100) // (C * 100)
                s = c * C + d * D
                w = l + s
                if 0 < w <= F:
                    # print(a, b, c, d, maxs100)
                    r = 100 * s / w
                    if r >= maxr:
                        maxr = r
                        result = w, s
                d += 1

print(*result)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = [int(_) for _ in input().split()]

maxr = 0
result = 0, 0

for a in range(31):
    for b in range(31):
        l = 100 * a * A + 100 * b * B
        if l <= F:
            maxs100 = E * l
            d = 0
            while d * D * 100 <= maxs100:
                c = (maxs100 - d * D * 100) // (C * 100)
                s = c * C + d * D
                w = l + s
                if 0 < w <= F:
                    # print(a, b, c, d, maxs100)
                    r = 100 * s / w
                    if r > maxr:
                        maxr = r
                        result = w, s
                d += 1

print(*result)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
max_con = (100*E)/(100+E)
W,S = [],[]
for i in range(0,F+1,100*A):
    j = 0
    while i+100*B*j<=F:
        W.append(i+100*B*j)
        j += 1
setW = set(W)
for i in range(0,F+1,C):
    j = 0
    while i+D*j<=F:
        S.append(i+D*j)
        j += 1
setS = set(S)
con = 0
total, ans_s = 0,0
for w in setW:
    for s in setS:
        if w==s==0:
            continue
        if (100*s)/(w+s)<=max_con and s+w<=F and con<(100*s)/(w+s):
            con = (100*s)/(w+s)
            total = w+s
            ans_s = s
print(total, ans_s)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
max_con = (100*E)/(100+E)
W,S = [],[]
for i in range(100*A,F,100*A):
    j = 0
    while i+100*B*j<=F:
        W.append(i+100*B*j)
        j += 1
setW = set(W)
for i in range(C,F,C):
    j = 0
    while i+D*j<=F:
        S.append(i+D*j)
        j += 1
setS = set(S)
con = 0
total, ans_s = 0,0
for w in setW:
    for s in setS:
        if (100*s)/(w+s)<=max_con and s+w<=F and con<(100*s)/(w+s):
            con = (100*s)/(w+s)
            total = w+s
            ans_s = s
print(total, ans_s)

Submission status: Wrong Answer

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

concentration = 0
limit_concentration = E / (E + 100)
result_sugar_water = 0
result_sugar = 0

for a in range(0, F, 100*A):
    for b in range(0, F, 100*B):
        for c in range(0, F, C):
            for d in range(0, F, D):
                if 0 < a + b + c + d <= F :
                    concentration_now = (c + d) / (a + b + c + d)
                    if concentration_now <= limit_concentration:
                        concentration = max(concentration, concentration_now)
                        result_sugar_water = a + b + c + d
                        result_sugar = c + d

print(result_sugar_water, result_sugar)

Submission status: Wrong Answer

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


noudo=0

satomizu=0
sato=0
Flug=False

NA1=F/(A*100)
NA=int(NA1)
NB1=F/(B*100)
NB=int(NB1)
NC1=F/C
NC=int(NC1)
ND1=F/D
ND=int(ND1)
if B%A ==0:
    NB=1
if D%C ==0:
    ND=1

jyogen=E/(100+E)
for a in range(1,NA+1):
    for b in range(NB):
        for c in range(NC):
            for d in range(ND):
                if  noudo<=(c*C+d*D)/(100*a*A +100*b*B+c*C+d*D) and (c*C+d*D)/(100*a*A +100*b*B+c*C+d*D)<=jyogen and (100*a*A +100*b*B+c*C+d*D)<=F:
                    noudo=(c*C+d*D)/(100*a*A +100*b*B+c*C+d*D)
                    satomizu=100*a*A +100*b*B+c*C+d*D
                    sato=c*C+d*D
                    if sato/satomizu == jyogen:
                        Flug=True
                        break
    if Flug==True:
            break
print(str(satomizu)+" "+str(sato))

Submission status: Wrong Answer

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


noudo=0

satomizu=0
sato=0
Flug=False

NA1=F/(A*100)
NA=int(NA1)
NB1=F/(B*100)
NB=int(NB1)
NC1=F/C
NC=int(NC1)
ND1=F/D
ND=int(ND1)
if B%A ==0:
    NB=1
if D%C ==0:
    ND=1

jyogen=E/(100+E)
for a in range(1,NA+1):
    for b in range(NB):
        for c in range(NC):
            for d in range(ND):
                if  noudo<(c*C+d*D)/(100*a*A +100*b*B+c*C+d*D) and (c*C+d*D)/(100*a*A +100*b*B+c*C+d*D)<=jyogen and (100*a*A +100*b*B+c*C+d*D)<=F:
                    noudo=(c*C+d*D)/(100*a*A +100*b*B+c*C+d*D)
                    satomizu=100*a*A +100*b*B+c*C+d*D
                    sato=c*C+d*D
                    if sato/satomizu == jyogen:
                        Flug=True
                        break
    if Flug==True:
            break
print(str(satomizu)+" "+str(sato))

Submission status: Wrong Answer

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


a=0
b=0

noudo=0

satomizu=0
sato=0

NA1=F/(A*100)
NA=int(NA1)
NB1=F/(B*100)
NB=int(NB1)
NC1=F/C
NC=int(NC1)
ND1=F/D
ND=int(ND1)
jyogen=E/(100+E)
for a in range(1,NA+1):
    for b in range(NB):
        for c in range(NC):
            for d in range(ND):
                if  noudo<(c*C+d*D)/(100*a*A +100*b*B+c*C+d*D) and (c*C+d*D)/(100*a*A +100*b*B+c*C+d*D)<jyogen and (100*a*A +100*b*B+c*C+d*D)<=F:
                    noudo=(c*C+d*D)/(100*a*A +100*b*B+c*C+d*D)
                    satomizu=100*a*A +100*b*B+c*C+d*D
                    sato=c*C+d*D
print(str(satomizu)+" "+str(sato))

Submission status: Wrong Answer

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

res = 0
res_sugar = 0
res_total = 0
for a_ in range(0, f//(100*a)+1):
    for b_ in range(0, f//(100*b)+1):
        for c_ in range(0, e+1, c):
            for d_ in range(0, e+1, d):
                if a_+b_+c_+d_ != 0 and 100*a_+100*b_+c_+d_ <= f and \
                        res < (c_+d_)/(100*a_+100*b_+c_+d_)*100 and e*(a_+b_) >= (c_+d_):
                    res = (c_+d_)/(100*a_+100*b_+c_+d_)*100
                    res_sugar = c_+d_
                    res_total = 100*a_+100*b_+c_+d_
print(res_total, res_sugar)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
print(str(99)+' '+str(1))
#境界？

Submission status: Wrong Answer

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

    tmp = 0
    ans = (0, 0)
    for i in range(F):
        for k in range(F):
            x = A * 100 * i + B * 100 * k
            y = C * i + D * k
            if x+y > F:
                continue
            if x + y == 0:
                continue
            if y > (x // 100) * E:
                continue
            tmp = max((100 * x) / (x + y), tmp)
            ans = "{0} {1}".format(x+y, y)
    return ans

print(m())

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//100+1):#f//100+1によりTLEを解消
    for j in range(f//100+1):
        x=100*a*i+100*j*b
        if 0<x<=f:
            water.append(x)
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if 0<y<=f:
            sugar.append(y)
sugar=list(set(sugar))
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
                    con=now
print(ans,ans_2)

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//100+1):#f//100+1によりTLEを解消
    for j in range(f//100+1):
        x=100*a*i+100*j*b
        if x<=f:
            water.append(x)
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if y<=f:
            sugar.append(y)
sugar=list(set(sugar))
for i in water:
    for j in sugar:
        if i+j<=f:
            if i!=0 or j!=0:
                if j<=i//100*e:
                    now=(100*j)/(i+j)
                    if con<now:
                        ans=i+j
                        ans_2=j
                        con=now
print(ans,ans_2)

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//100+1):#f//100+1によりTLEを解消
    for j in range(f//100+1):
        x=100*a*i+100*j*b
        if 0<x<=f:
            water.append(x)
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if y<=f:
            sugar.append(y)
sugar=list(set(sugar))
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
                    con=now
print(ans,ans_2)

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//100+1):#f//100+1によりTLEを解消
    for j in range(f//100+1):
        x=100*a*i+100*j*b
        if 0<x<=f:
            water.append(x)
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if 0<y<=f:
            sugar.append(y)
sugar=list(set(sugar))
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
                    con=now
print(ans,ans_2)

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):
    for j in range(f):
        x=100*a*i+100*j*b
        if 0<x<=f:
            water.append(x)
water=list(set(water))
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if 0<y<=f:
            sugar.append(y)
sugar=list(set(sugar))
sugar.sort()
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
                    con=now
print(ans,ans_2)

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//100+1):
    for j in range(f//100+1):
        x=100*a*i+100*j*b
        if 0<x<=f:
            water.append(x)
water=list(set(water))
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if 0<y<=f:
            sugar.append(y)
sugar=list(set(sugar))
sugar.sort()
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
                    con=now
print(ans,ans_2)

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)
sugar=list(set(sugar))
sugar.sort()
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
                    con=now
print(ans,ans_2)