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:
import math

# A = 1
# B = 2
# C = 10
# D = 20
# E = 15
# F = 200


# A = 1
# B = 2
# C = 1
# D = 2
# E = 100
# F = 1000

#
# A = 30
# B = 30
# C = 2
# D = 26
# E = 100
# F = 3000


S = input().split(" ")
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
E = int(S[4])
F = int(S[5])

def calculate(a, b, c, d, e, f):
    result = []

    for x in range(0,31):
        for y in range(0,31):
            if a * x * 100 + b * y * 100 <= F:
                result.append([x, y])

    maxNondu = 0
    finalResult = []

    for res in result:
        waterValue = res[0] * 100 * a + res[1] * 100 * b
        for m in range(0, 101):
            for n in range(0, 101):

                sugerValue = m * c + n * d
                if waterValue + sugerValue < f:

                    if (waterValue / 100 * e) >= sugerValue:

                        if sugerValue + waterValue > 0:
                            nondu = (sugerValue * 100) / (sugerValue + waterValue)
                            if nondu >= maxNondu:
                                maxNondu = nondu
                                finalResult = [sugerValue+waterValue,sugerValue]
                        else:
                            nondu = 0
                            if nondu >= maxNondu:
                                maxNondu = nondu
                                finalResult = [sugerValue + waterValue, sugerValue]

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


calculate(A, B, C, D, E, F)

Submission status: Wrong Answer

Solution code:
import math

# A = 1
# B = 2
# C = 10
# D = 20
# E = 15
# F = 200


# A = 1
# B = 2
# C = 1
# D = 2
# E = 100
# F = 1000

#
# A = 30
# B = 30
# C = 2
# D = 26
# E = 100
# F = 3000


S = input().split(" ")
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
E = int(S[4])
F = int(S[5])

def calculate(a, b, c, d, e, f):
    result = []

    for x in range(math.ceil(f / (a * 100))):
        for y in range(math.ceil((f - x * a * 100) / (b * 100))):
            if a * x * 100 + b * y * 100 <= F:
                result.append([x, y])

    maxNondu = 0
    finalResult = []

    for res in result:
        waterValue = res[0] * 100 * a + res[1] * 100 * b
        for m in range(0, (f - waterValue)//c ):
            for n in range(0, (f - waterValue - m * c)//d):

                sugerValue = m * c + n * d
                if waterValue + sugerValue < f:

                    if (waterValue / 100 * e) >= sugerValue:

                        if sugerValue + waterValue > 0:
                            nondu = (sugerValue * 100) / (sugerValue + waterValue)
                            if nondu >= maxNondu:
                                maxNondu = nondu
                                finalResult = [sugerValue+waterValue,sugerValue]
                        else:
                            nondu = 0
                            if nondu >= maxNondu:
                                maxNondu = nondu
                                finalResult = [sugerValue + waterValue, sugerValue]

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


calculate(A, B, C, D, E, F)

Submission status: Wrong Answer

Solution code:
import math

S = input().split(" ")
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
E = int(S[4])
F = int(S[5])

def calculate(a, b, c, d, e, f):
    result = []

    for x in range(math.ceil(f / (a * 100))):
        for y in range(math.ceil(f / (b * 100))):
            result.append([x, y])

    maxNondu = 0
    finalResult = []
    for res in result:
        m = 0
        waterValue = res[0] * 100 * a + res[1] * 100 * b

        while waterValue + m <= f:
            n = 0
            sugerValue = m * c + n * d
            while waterValue + sugerValue <= F:
                sugerValue = m * c + n * d
                if math.ceil(sugerValue / e) * 100 <= waterValue:
                    if sugerValue + waterValue > 0:
                        nondu = sugerValue * 100 / (sugerValue + waterValue)
                        if nondu > maxNondu:
                            maxNondu = nondu

                            finalResult = [waterValue + sugerValue, sugerValue]

                n = n + 1
            m = m + 1

    if len(finalResult) == 0:
        print("{} {}".format(a,0))
    else:
        print("{} {}".format(finalResult[0],finalResult[1]))


calculate(A, B, C, D, E, F)

Submission status: Wrong Answer

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

max_w = 0
max_s = 0
dens = 0
for a in range((F//(100*A))+1):
    for b in range((F//(100*B))+1):
        for c in range((F//C)+1):
            for d in range((F//D)+1):
                if 100*(A*a+B*b) + c*C + d*D > F:
                    break
                elif (c*C+d*D) <= (A*a+B*b)*E and 100*(A*a+B*b) != 0:
                    temp_dens = (C*c+D*d)/(C*c+D*d+100*(A*a+B*b))
                    if temp_dens > dens:
                        max_w = 100*(A*a+B*b)
                        max_s = C*c + D*d
                        dens = temp_dens
                    
print(max_w + max_s, max_s)

Submission status: Wrong Answer

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

max_w = 0
max_s = 0
dens = 0
for a in range((F//(100*A))+1):
    for b in range((F//(100*B))+1):
        for c in range((F//C)+1):
            for d in range((F//D)+1):
                if 100*(A*a+B*b) + c*C + d*D > F:
                    break
                elif (c*C+d*D) <= (A*a+B*b)*E and (C*c+D*d+100*(A*a+B*b)) != 0:
                    temp_dens = (C*c+D*d)/(C*c+D*d+100*(A*a+B*b))
                    if temp_dens > dens:
                        max_w = 100*(A*a+B*b)
                        max_s = C*c + D*d
                        dens = temp_dens
                    
print(max_w + max_s, max_s)

Submission status: Wrong Answer

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

max_w = 0
max_s = 0
dens = 0
for a in range(int(F/(100*A))+1):
    for b in range(int(F/(100*B))+1):
        for c in range(int(F/C)+1):
            for d in range(int(F/D)+1):
                if 100*(A*a+B*b) + c*C + d*D > F:
                    break
                elif (c*C+d*D) <= (A*a+B*b)*E and (C*c+D*d+100*(A*a+B*b)) != 0:
                    temp_dens = (C*c+D*d)/(C*c+D*d+100*(A*a+B*b))
                    if temp_dens > dens:
                        max_w = 100*(A*a+B*b)
                        max_s = C*c + D*d
                        dens = temp_dens
                    
print(max_w + max_s, max_s)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
#                di=(max(0,(c31-ci-1))//d)*d
#                di=min(di,((e*w/100-ci)//d)*d)
                di=int(max(0,(min(f-w-ci-1,e*w/100-ci)//d)*d))
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
#                di=(max(0,(c31-ci-1))//d)*d
#                di=min(di,((e*w/100-ci)//d)*d)
                di=int(max(0,(min(w-ci-1,e*w/100-ci)//d)*d))
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
                di=(max(0,(c31-ci-1))//d)*d
                di=min(di,((e*w/100-ci)//d)*d)
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
                di=(max(0,(c31-ci-1))//d)*d
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
                di=((c31-ci-1)//d)*d
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
                di=((c31-ci)//d)*d
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            c31=(w*e)//100+1
            for ci in range(0,c31,c):
#                for di in range(d31):
                for di in range(0,c31-c,d):
                    indx=(ci+di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                        wmax=w+ci+di
                        indxmax=indx 
                        emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
a31=int(f/100/a)+1
b31=int(f/100/b)+1
c31=int(f/c)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    diii=max(0,di)
#                    indx=(c*ci+d*diii)*100/w
                    indx=100*(c*ci+d*diii)/(w+c*ci+d*diii)
                    if indxmax<indx and elimit-indx>=0.0 and w+c*ci+d*diii<=f:
                        wmax=int(w+c*ci+d*diii)
                        indxmax=indx 
                        emax=int(c*ci+d*diii)
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

A, B, C, D, E, F = (int(x) for x in input().strip().split())

max_A = F // (A * 100) #操作１を実行できる回数
max_B = F // (B * 100) #操作２を実行できる回数

roop = 0
for i in range(max_A + 1):
    if roop == 1:
        break
    for j in range(max_B + 1):
        max_melt = E * (i + j)
        rem = F - (100 * A * i + 100 * B * j) #容器の残り
        if rem >= C or rem >= D:
            c = 0
            d = 0
            while rem >= C and max_melt >= C:
                rem -= C
                max_melt -= C
                c += 1
            while rem >= D and max_melt >= D:
                rem -= D
                max_melt -= D
                d += 1
            if c >= 1 or d >= 1:
                roop = 1
                break

print(100 * (i - 1) * A + 100 * j * B + c * C + d * D, end=" ")
print(c * C + d * D)

Submission status: Wrong Answer

Solution code:
# まずは全探索砂糖の質量、水の質量はともにO(F^2)だがそれらの組み合わせもO(F^2)であること（上限がFだから）に注意
A,B,C,D,E,F = map(int,input().split())
water = set()
for water1 in range(0,F+1,100*A):
    for water2 in range(0,F+1,100*B):
        if water1 + water2 <= F:
            water.add(water1+water2)

sugar = set()
for sugar1 in range(0,F+1,C):
    for sugar2 in range(0,F+1,D):
        if sugar1 + sugar2 <= F:
            sugar.add(sugar1+sugar2)
# print(water)
# print(sugar)
ans_s = 0
ans_w = 0
max_c = 0
for w in water:
    for s in sugar:
        if 0< w + s <= F:
            if w//100*E >= s:
                if max_c < (100*s)/(s+w):
                    ans_s = s
                    ans_w = w
                    max_c = (100*s)/(s+w)
print(ans_w+ans_s,ans_s)

Submission status: Wrong Answer

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

# 100A,100B の水
for a in range(1 + F // 100):
    for b in range(1 + F // 100):
        water = 100 * (a * A + b * B)
        if 0 < water <= F:
            W.append(water)

# c,d の砂糖
for c in range(1 + F // C):
    for d in range(1 + F // D):
        sugar = c * C + d * D
        if 0 < sugar <= F:
            S.append(sugar)

W = list(set(W))
S = list(set(S))

x = 0
X,Y = W[0]+S[0],S[0]
for w in W:
  for s in S:
    if w + s <= F:
        sol = 100 * s / w
        if x < sol <= E:
            x = sol
            X, Y = w + s, s

print(X,Y)

Submission status: Wrong Answer

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

weight = 0
suger = 0
den = 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
        S = E * w // 100
        for c in range(0, S + 1, C):
            for d in range(0, S - c + 1, D):
                s = c + d
                if w > 0 and w + s <= F and w * E >= s * 100:
                    tden = s / w
                    if den < tden:
                        weight = s + w
                        suger = s
                        den = tden

print(weight, suger)

Submission status: Wrong Answer

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

weight = 0
suger = 0
den = 0
for a in range(0, F + 1, 100 * A):
    for b in range(0, F - a + 1, 100 * B):
        w = a + b
        S = E * w // 100
        for c in range(0, S + 1, C):
            for d in range(0, S - c + 1, D):
                s = c + d
                if w > 0 and w + s <= F and w * E >= s * 100:
                    tden = s / w
                    if den < tden:
                        weight = s + w
                        suger = s
                        den = tden

print(weight, suger)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=[int(x) for x in input().split()]

ans=0
ans_s=0
ans_all=0
wlist=[]
slist=[]
for i in range(f//(100*a)+1):
    for j in range((f-i*100*a)//(100*b)+1):
        wlist.append(100*a*i+100*b*j)
for i in range((f*e//100)//c+1):
    for j in range((f*e//100)//d+1):
        slist.append(c*i+d*j)
wlist=set(wlist)
slist=set(slist)
for w in wlist:
    for s in slist:
        if w+s==0:break
        if s*100/(w+s)>ans and w*e/100>=s and w+s<=f:
            ans=s*100/(w+s)
            ans_s=s
            ans_all=w+s
print(ans_all,ans_s)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
a31=int(f/100/a)+1
b31=int(f/100/b)+1
c31=int(f/c)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    diii=max(0,di)
                    indx=(c*ci+d*diii)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*diii<=f:
                        wmax=int(w+c*ci+d*diii)
                        indxmax=indx 
                        emax=int(c*ci+d*diii)
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
a31=int(f/100/a)+1
b31=int(f/100/b)+1
c31=int(f/c)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    indx=(c*ci+d*max(0,di))*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
a31=int(f/100/a)+1
b31=int(f/100/b)+1
c31=int(f/c)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
a31=int(f/100/a)+1
b31=int(f/100/b)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
a31=int(f/a)+1
b31=int(f/b)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=int((w/100*e-c*ci)/d)
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
a31=int(f/a)+1
b31=int(f/b)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=int((w/100*e-c*ci)/d)
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
a31=int(f/a)+1
b31=int(f/b)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                di=int((w/100*e-c*ci)/d)
#                for di in range(d31):
                for dii in range(1):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
a31=int(f/a)+1
b31=int(f/b)+1
for ai in range(31):
    for bi in range(31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                di=int((w/100*e-c*ci)/d)
#                for di in range(d31):
                for dii in range(1):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
for ai in range(31):
    for bi in range(31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                di=int((w/100*e-c*ci)/d)
#                for di in range(d31):
                for dii in range(1):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
for ai in range(31):
    for bi in range(31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                di=int((w/100*e-c*ci)/d)
#                for di in range(d31):
                for dii in range(1):
                    indx=(c*ci+d*di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                        wmax=int(w+c*ci+d*di)
                        indxmax=indx 
                        emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
for ai in range(31):
    for bi in range(31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f:
            for ci in range(31):
#                di=int((w/100*e-c*ci-1)/d)+1
                di=int((w/100*e-c*ci)/d+10**(-10))
#                print("a,b,c,d*",ai,bi,ci,di,ci*c+di*d)
                if c*ci+d*di<=0:
                    indx=0
                elif w==0:
                    indx=0
                else:
                    indx=(c*ci+d*di)*100/w
#                print("a,b,c,d*,indx",ai,bi,ci,di,ci*c+di*d,indx)
#                print(indxmax<indx ,e-indx>=0.0 ,f-(w+c*ci+d*di)>=0.0)
                if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                    wmax=int(w+c*ci+d*di)
                    indxmax=indx 
                    emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)

Submission status: Wrong Answer

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

indxmax=0
wmax=0
emax=0
for ai in range(min(int(f/100/a)+1,31)):
    if ai==0:
        a30=31
    else:
        a30=min(31,int((f-100*a*ai)/100/b)+1)
    for bi in range(a30):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f:
            for ci in range(min(31,int(w/100*e/c)+1)):
#                di=int((w/100*e-c*ci-1)/d)+1
                di=int((w/100*e-c*ci)/d+10**(-10))
#                print("a,b,c,d*",ai,bi,ci,di,ci*c+di*d)
                if c*ci+d*di<=0:
                    indx=0
                elif w==0:
                    indx=0
                else:
                    indx=(c*ci+d*di)*100/w
#                print("a,b,c,d*,indx",ai,bi,ci,di,ci*c+di*d,indx)
#                print(indxmax<indx ,e-indx>=0.0 ,f-(w+c*ci+d*di)>=0.0)
                if indxmax<indx and e-indx>=0.0 and w+c*ci+d*di<=f:
                    wmax=int(w+c*ci+d*di)
                    indxmax=indx 
                    emax=int(c*ci+d*di)
#                    print("c,d",ci,di,emax,wmax)
print(wmax,emax)