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

    x = F/(100+E)

    sugar_ws = [C, D]

    for i in range(101):
        for j in range(i, 101):
            if C*i + D*j > E*x:
                break
            sugar_ws.append(C*i + D*j)
    
    water_ws = [A*100, B*100]
    for i in range(101):
        for j in range(i, 101):
            if 100*A*i + 100*B*j > 100*x:
                break
            water_ws.append(100*A*i + 100*B*j)
    
    sugar_ws.sort()
    water_ws.sort()
            
    max_w = 0
    max_s = 0
    max_per = 0
    for water_w in water_ws:
        for sugar_w in sugar_ws:
            if water_w + sugar_w > F or sugar_w/E*100 > water_w:
                break

            if (sugar_w + water_w) != 0 and (100*sugar_w)/(sugar_w+water_w) > max_per:
                max_per = (100*sugar_w)/(sugar_w+water_w)
                max_s = sugar_w
                max_w = water_w
    
    print("{} {}".format((max_s+max_w), max_s))

main()

Submission status: Wrong Answer

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

    x = F/(100+E)

    sugar_ws = [C, D]

    for i in range(101):
        for j in range(i, 101):
            if C*i + D*j > E*x:
                break
            sugar_ws.append(C*i + D*j)
    
    water_ws = [A*100, B*100]
    for i in range(30+1):
        for j in range(i, 30+1):
            if 100*A*i + 100*B*j > 100*x:
                break
            water_ws.append(100*A*i + 100*B*j)
    
    sugar_ws.sort()
    water_ws.sort()
            
    max_w = 0
    max_s = 0
    max_per = 0
    for water_w in water_ws:
        for sugar_w in sugar_ws:
            if water_w + sugar_w > F or sugar_w/E*100 > water_w:
                break

            if (sugar_w + water_w) != 0 and (100*sugar_w)/(sugar_w+water_w) > max_per:
                max_per = (100*sugar_w)/(sugar_w+water_w)
                max_s = sugar_w
                max_w = water_w
    
    print("{} {}".format((max_s+max_w), max_s))

main()

Submission status: Wrong Answer

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

    x = F/(100+E)

    sugar_ws = [C, D]

    for i in range(30):
        for j in range(i, 30):
            if C*(i+1) + D*(j+1) > E*x:
                break
            sugar_ws.append(C*(i+1) + D*(j+1))
    
    water_ws = [A, B]
    for i in range(30):
        for j in range(i, 30):
            if A*(i+1) + B*(j+1) > 100*x:
                break
            water_ws.append(A*(i+1) + B*(j+1))
    
    sugar_ws.sort()
    water_ws.sort()
            
    max_w = 0
    max_s = 0
    max_per = 0
    for water_w in water_ws:
        for sugar_w in sugar_ws:
            if water_w + sugar_w > F or sugar_w/E*100 > water_w:
                break

            if (100*sugar_w)/(sugar_w+water_w) > max_per:
                max_per = (100*sugar_w)/(sugar_w+water_w)
                max_s = sugar_w
                max_w = water_w
    
    print("{} {}".format((max_s+max_w), max_s))

main()

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+100*b*j
        if water > f:
            break
        Water.append(water)
for i in range(f//min(c,d)+1):
    for j in range(f//min(c,d)+1):
        sugar = c*i + d*j
        if sugar > f:
            break 
        Sugar.append(sugar)
Sugar=list(set(Sugar))
Water = list(set(Water))
        

def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 100*a,0
for i in Water:
    for j in Sugar:
        if (i/100*e >= j) and (i+j < f):
            tmp = Noudo(i,j)
            if Max < tmp:
                Max = tmp
                tmp_w = i+j
                tmp_s = j
print(tmp_w,tmp_s)

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+100*b*j
        if water > f:
            break
        Water.append(water)
for i in range(f//min(c,d)+1):
    for j in range(f//min(c,d)+1):
        sugar = c*i + d*j
        if sugar > f:
            break 
        Sugar.append(sugar)
Sugar=list(set(Sugar))
Water = list(set(Water))
        

def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 0,0
for i in Water:
    for j in Sugar:
        if (i/100*e >= j) and (i+j < f):
            tmp = Noudo(i,j)
            if Max < tmp:
                Max = tmp
                tmp_w = i+j
                tmp_s = j
print(tmp_w,tmp_s)

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+100*b*j
        if water > f:
            break
        Water.append(water)
for i in range(f//min(c,d)+1):
    for j in range(f//min(c,d)+1):
        sugar = c*i + d*j
        if sugar > f:
            break 
        Sugar.append(sugar)
Sugar=list(set(Sugar))
Water = list(set(Water))
        

def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 0,0
for i in Water:
    for j in Sugar:
        if (i/100*e > j) and (i+j < f):
            tmp = Noudo(i,j)
            if Max < tmp:
                Max = tmp
                tmp_w = i+j
                tmp_s = j
print(tmp_w,tmp_s)

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+200*b*j
        if water > f:
            break
        Water.append(water)
for i in range(f//min(c,d)+1):
    for j in range(f//min(c,d)+1):
        sugar = c*i + d*j
        if sugar > f:
            break 
        Sugar.append(sugar)
Sugar=list(set(Sugar))
Water = list(set(Water))
        
print(Water)
print(Sugar)
def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 0,0
for i in Water:
    for j in Sugar:
        if (i/100*e > j) and (i+j < f):
            tmp = Noudo(i,j)
            if Max < tmp:
                Max = tmp
                tmp_w = i+j
                tmp_s = j
print(tmp_w,tmp_s)

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+100*b*j
        if water > f:
            break
        Water.append(water)
for i in range(f//min(c,d)+1):
    for j in range(f//min(c,d)+1):
        sugar = c*i + d*j
        if sugar > f:
            break 
        Sugar.append(sugar)
Sugar=list(set(Sugar))
Water = list(set(Water))
        
print(Water)
print(Sugar)
def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 0,0
for i in Water:
    for j in Sugar:
        if (i/100)*e > j and i+j < f:
            tmp = Noudo(i,j)
            if Max < tmp:
                Max = tmp
                tmp_w = i+j
                tmp_s = j
print(tmp_w,tmp_s)

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+100*b*j
        Water.append(water)
for i in range(0,31):
    for j in range(1,31):
        sugar = c*i + d*j
        Sugar.append(sugar)
set(Sugar)
set(Water)
        

def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 0,0
for i in Water:
    for j in Sugar:
        if (i/100)*e > j:
            tmp = Noudo(i,j)
            if Max < tmp:
                Max = tmp
                tmp_w = i+j
                tmp_s = j
print(tmp_w,tmp_s)

Submission status: Wrong Answer

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

for i in range(0,31):
    for j in range(0,31):
        water = 100*a*i+100*b*j
        sugar = c*i + d*j
        if water+sugar < f:
            Water.append(water)
            Sugar.append(sugar) 
def Noudo(x,y):
    if(x>0 and y>0):
        return 100*y/(x+y)
    else:
        return 0
Max = 0
tmp_w,tmp_s = 0,0
for i in range(len(Water)):
    tmp = Noudo(Water[i],Sugar[i])
    if (Max < tmp):
        Max = tmp
        tmp_w = Water[i]+Sugar[i]
        tmp_s = Sugar[i]
print(tmp_w,tmp_s)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split());ans,ma=[0]*2,0
for i in range(f//100+1):
  if i%b==0 or i%a==0:
    w=i*100
    x=min(f-w,i*e)
    s=0
    for j in range(x//c+1):
      ss=j*c
      s=max(s,ss+((x-ss)//d)*d)
    if w!=0:
      if ma<=(100*s)//(w+s):ans=[w,s];ma=(100*s)//(w+s)
print(ans[0]+ans[1],ans[1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split());ans,ma=[0]*2,0
for i in range(f//100+1):
  if i%b==0 or i%a==0:
    w=i*100
    x=min(f-w,i*e)
    s=0
    for j in range(x//c+1):
      ss=j*c
      s=max(s,ss+((x-ss)//d)*d)
    if s!=0:
      if ma<(100*s)//(w+s):ans=[w,s];ma=(100*s)//(w+s)
print(ans[0]+ans[1],ans[1])

Submission status: Wrong Answer

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

water = set()
for i in range(31):
    for j in range(31):
        w = i*a + j*b 
        if w <= f // 100:
            water.add(w)
sugar = set()
for i in range(1501):
    j = 0
    while i*c + j*d <= 1500:
        sugar.add(i*c + j*d)
        j += 1
sugar = sorted(sugar)
ans = []
for w in water:
    sid = bisect.bisect_left(sugar, w*e) - 1
    while sugar[sid] + w*100 > f:
        sid -= 1
    if w != 0:
        total = w*100 + sugar[sid]
        ans.append([sugar[sid]/total, total, sugar[sid]])
ans.sort(key=lambda x:x[0])
print(ans[-1][1], ans[-1][2])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().rstrip().split())
water = []
for i in range(A+1):
    for j in range(B+1):
        tmp = A*i*100 + B*j*100
        if tmp < F: 
            water.append(tmp)
        else:
            break
water.sort(reverse=True)
water.pop()
maximum = [0, 0]
concentration = 0
for i in water:
    multi = i//100
    suger_limit = E*multi if E*multi + i <= F else F - i
    for j in range(100):
        for k in range(100):
            suger = C*j + D*k
            if suger > suger_limit:
                break
            if concentration < 100*suger / (i + suger):
                concentration = 100*suger / (i + suger)
                maximum = [i+suger, suger]
print(*maximum, sep=" ")

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=[]
Y=[]
for i in range(31):
    for j in range(31):
        x=100*A*i+100*B*j
        if x<=F:
            X.append(x)
for i in range(1501):
    for j in range(1501):
        y=C*i+D*j
        if y<=F:
            Y.append(y)

X=set(X)
Y=set(Y)
X=list(X)
Y=list(Y)
X.sort()
Y.sort()
#print(X)
#print(Y)

e=(100*E)/(100+E)
ans=0
x_ans=0
y_ans=0
#print("e",e)
flag=False
for i in range(len(X)):
    for j in range(len(Y)):
        if X[i]+Y[j]<=F and X[i]+Y[j]!=0:
            dense=(100*Y[j])/(X[i]+Y[j])
            #print(dense)
            if dense<=e:
                flag=True#suger exist
            #if Y[j]<=(E*X[i]/100):
                if ans<dense:
                    ans=dense
                    #print(X[i])
                    #print(Y[j])
                    x_ans=X[i]+Y[j]
                    y_ans=Y[j]
if flag:
    print(x_ans,y_ans)
else:
    water=A
    print(A,0)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=[]
Y=[]
for i in range(31):
    for j in range(31):
        x=100*A*i+100*B*j
        if x<=F:
            X.append(x)
for i in range(1501):
    for j in range(1501):
        y=C*i+D*j
        if y<=F:
            Y.append(y)

X=set(X)
Y=set(Y)
X=list(X)
Y=list(Y)
X.sort()
Y.sort()
#print(X)
#print(Y)

e=(100*E)/(100+E)
ans=0
x_ans=0
y_ans=0
#print("e",e)
flag=False
for i in range(len(X)):
    for j in range(len(Y)):
        if X[i]+Y[j]<=F and X[i]+Y[j]!=0:
            dense=(100*Y[j])/(X[i]+Y[j])
            #print(dense)
            if dense<=e:
                flag=True#no suger
            #if Y[j]<=(E*X[i]/100):
                if ans<dense:
                    ans=dense
                    #print(X[i])
                    #print(Y[j])
                    x_ans=X[i]+Y[j]
                    y_ans=Y[j]
if flag:
    print(x_ans,y_ans)
else:
    print((X[1]//100),0)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=[]
Y=[]
for i in range(31):
    for j in range(31):
        x=100*A*i+100*B*j
        if x<=F:
            X.append(x)
for i in range(1501):
    for j in range(1501):
        y=C*i+D*j
        if y<=F:
            Y.append(y)

X=set(X)
Y=set(Y)
X=list(X)
Y=list(Y)
X.sort()
Y.sort()
#print(X)
#print(Y)

e=(100*E)/(100+E)
ans=0
x_ans=0
y_ans=0
#print("e",e)
flag=False
for i in range(len(X)):
    for j in range(len(Y)):
        if X[i]+Y[j]<=F and X[i]+Y[j]!=0:
            dense=(100*Y[j])/(X[i]+Y[j])
            #print(dense)
            if dense<=e:
                flag=True#no suger
            #if Y[j]<=(E*X[i]/100):
                if ans<dense:
                    ans=dense
                    #print(X[i])
                    #print(Y[j])
                    x_ans=X[i]+Y[j]
                    y_ans=Y[j]
if flag:
    print(x_ans,y_ans)
else:
    print(max((X//100)),0)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=[]
Y=[]
for i in range(31):
    for j in range(31):
        x=100*A*i+100*B*j
        if x<=F:
            X.append(x)
for i in range(1501):
    for j in range(1501):
        y=C*i+D*j
        if y<=F:
            Y.append(y)

X=set(X)
Y=set(Y)
X=list(X)
Y=list(Y)
X.sort()
Y.sort()
#print(X)
#print(Y)

e=(100*E)/(100+E)
ans=0
x_ans=0
y_ans=0
#print("e",e)
flag=False
for i in range(len(X)):
    for j in range(len(Y)):
        if X[i]+Y[j]<=F and X[i]+Y[j]!=0:
            dense=(100*Y[j])/(X[i]+Y[j])
            #print(dense)
            if dense<=e:
                flag=True#no suger
            #if Y[j]<=(E*X[i]/100):
                if ans<dense:
                    ans=dense
                    #print(X[i])
                    #print(Y[j])
                    x_ans=X[i]+Y[j]
                    y_ans=Y[j]
if flag:
    print(x_ans,y_ans)
else:
    print(max(X),0)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=[]
Y=[]
for i in range(31):
    for j in range(31):
        x=100*A*i+100*B*j
        if x<=F:
            X.append(x)
for i in range(101):
    for j in range(101):
        y=C*i+D*j
        if y<=F:
            Y.append(y)

X=set(X)
Y=set(Y)
X=list(X)
Y=list(Y)
X.sort()
Y.sort()
#print(X)
#print(Y)

e=(100*E)/(100+E)
ans=0
x_ans=0
y_ans=0
#print("e",e)
flag=False
for i in range(len(X)):
    for j in range(len(Y)):
        if X[i]+Y[j]<=F and X[i]+Y[j]!=0:
            dense=(100*Y[j])/(X[i]+Y[j])
            #print(dense)
            if dense<=e:
                flag=True#no suger
            #if Y[j]<=(E*X[i]/100):
                if ans<dense:
                    ans=dense
                    #print(X[i])
                    #print(Y[j])
                    x_ans=X[i]+Y[j]
                    y_ans=Y[j]
if flag:
    print(x_ans,y_ans)
else:
    print(max(X),0)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=[]
Y=[]
for i in range(31):
    for j in range(31):
        x=100*A*i+100*B*j
        if x<=F:
            X.append(x)
for i in range(101):
    for j in range(101):
        y=C*i+D*j
        if y<=F:
            Y.append(y)

X=set(X)
Y=set(Y)
X=list(X)
Y=list(Y)
X.sort()
Y.sort()
#print(X)
#print(Y)

e=(100*E)/(100+E)
ans=0
x_ans=0
y_ans=0
#print("e",e)
for i in range(len(X)):
    for j in range(len(Y)):
        if X[i]+Y[j]<=F and X[i]+Y[j]!=0:
            dense=(100*Y[j])/(X[i]+Y[j])
            #print(dense)
            if dense<=e:
            #if Y[j]<=(E*X[i]/100):
                if ans<dense:
                    ans=dense
                    #print(X[i])
                    #print(Y[j])
                    x_ans=X[i]+Y[j]
                    y_ans=Y[j]
print(x_ans,y_ans)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0

i = 1
j = 0
while(wtr < F):
  while(wtr < F):
    W.add(wtr)
    wtr = i*A*100 + j*B*100
    j +=1
  i +=1
  j = 0
  
i = 0
j = 0
while(sgr < F):
  while(sgr < F):
    S.add(sgr)
    sgr = i*C + j*D
    j +=1
  i +=1
  j = 0
answtr = 100*A
anssgr = 0
for wtr in W:
  for sgr in S:
    if (sgr*answtr > anssgr*(wtr+sgr)) and (sgr*(100+E)<=E*(wtr+sgr)):
      answtr = wtr
      anssgr = sgr
print("{} {}".format(answtr+anssgr, anssgr))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
waters = set()
iM = F//(100*A) + (not not F%(100*A))
jM = F//(100*B) + (not not F%(100*B))
for i in range(iM):
    for j in range(jM):
        if i*A*100+j*B*100>F:
            continue
        else:
            waters.add((i*A*100+j*B*100,(i*A+j*B)*E))

waters = list(waters)
waters.sort()

maxW,maxS = 100,0
sugars = [False]*3001
sugars[0] = True

for i in range(3001):
    if sugars[i]:
        if i+C <3001:
            sugars[i+C]=True
        if i+D <3001:
            sugars[i+D]=True 
#print(waters)
for water,sugarM in waters:
    for i in range(sugarM,-1,-1):
        if i+water>F:
            continue
        if sugars[i]:
            maxSugar = i
            break
#    print(water,maxSugar) 
    if (maxSugar+water)*maxS<maxSugar*(maxW+maxS):
        maxW = water
        maxS = maxSugar
print(maxW+maxS,maxS)

Submission status: Wrong Answer

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

waters = set()
for i in range(F + 1):
    for j in range(F + 1):
        water = 100 * A * i + 100 * B * j
        if water <= F:
            waters.add(water)
waters.remove(0)

sugars = set()
for i in range(F + 1):
    for j in range(F + 1):
        sugar = C * i + D * j
        if sugar <= F:
            sugars.add(sugar)

max_percentage = 0
max_water = 0
max_sugar = 0
limit_percentage = (100 * E) / (100 + E)

for water in waters:
    for sugar in sugars:
        percentage = (100 * sugar) / (water + sugar)
        if max_percentage < percentage <= limit_percentage and water + sugar <= F:
            max_percentage = percentage
            max_water = water
            max_sugar = sugar

print('{} {}'.format(max_water + max_sugar, max_sugar))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
ans = []
for ai in range(31):
    bb = (f - (ai * a * 100)) // b
    for bi in range(bb):
        if ai == bi == 0:
            continue
        cc = (f - (ai * a * 100 + bi * b * 100)) // c
        for ci in range(cc):
            dd = (f - (ai * a * 100 + bi * b * 100 + ci * c)) // d
            for di in range(dd):
                if 100 * a * ai + 100 * b * bi + c * ci + d * di <= f:
                    if (c * ci + d * di)/(100 * a * ai + 100 * b * bi) <= e/100:
                        ans.append([(c * ci + d * di)/(100 * a * ai + 100 * b * bi + c * ci + d * di), 100 * a * ai + 100 * b * bi + c * ci + d * di, c * ci + d * di])
ans.sort(reverse=True)
print(ans[0][1], ans[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
ans = []
dd = f // d
for ai in range(31):
    bb = (f - (ai * a * 100)) // b
    for bi in range(bb):
        cc = (f - (ai * a * 100 + bi * b * 100)) // c
        for ci in range(cc):
            dd = (f - (ai * a * 100 + bi * b * 100 + ci * c)) // d
            for di in range(dd):
                if ai == bi == 0:
                        continue
                if 100 * a * ai + 100 * b * bi + c * ci + d * di <= f:
                    if (c * ci + d * di)/(100 * a * ai + 100 * b * bi) <= e/100:
                        ans.append([(c * ci + d * di)/(100 * a * ai + 100 * b * bi + c * ci + d * di), 100 * a * ai + 100 * b * bi + c * ci + d * di, c * ci + d * di])
ans.sort(reverse=True)
print(ans[0][1], ans[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
beaker = {'water':0, 'sugar':0, 'percent':0}
maxpercent=e/(100+e)
maxtimes = f // (100 + e)
maxc = e*maxtimes//c
percent = 0
for i in range(maxc + 1):
    for j in range((e*maxtimes-i*c)//d + 1):
        sugar = i*c + j*d
        minwater = sugar/maxpercent
        maxa = int((minwater + 100*a)//(100*a))
        maxb = int((minwater + 100*b)//(100*b))
        for atimes in range(maxa + 1):
            for btimes in range(maxb + 1):
                if 100 * (atimes * a + btimes * b)< minwater:
                    continue
                water = 100 * (atimes * a + btimes * b)
                if water + sugar == 0 or water + sugar > f:
                    continue
                percent = 100 * sugar/(water + sugar)
                if beaker['percent'] <= percent:
                    beaker['water']=water
                    beaker['sugar']=sugar
                    beaker['percent']=percent
print(str(beaker['water']+beaker['sugar']) + ' ' + str(beaker['sugar']))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
water=[]
salt=[]
for i in range(30):
  for j in range(30):
    x=a*100*i+b*100*j
    if x<=f:
      water.append(x)
for i in range(1501):
  for j in range(1501):
    x=c*i+d*j
    if x<=f:
      salt.append(x)
water=list(set(water))
salt=list(set(salt))
stack=0
ans_sol=0
ans_sal=0
for i in water:
  for j in salt:
    if 1<=i+j<=f and j*100<=i*e:
      if j/(i+j)>stack:
        stack=j/(i+j)
        ans_sol=i+j
        ans_sal=j
print(ans_sol,ans_sal)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
water=[]
salt=[]
for i in range(30):
  for j in range(30):
    x=a*100*i+b*100*j
    if x<=f:
      water.append(x)
for i in range(1501):
  for j in range(1501):
    x=c*i+d*j
    if x<=f:
      salt.append(x)
water=list(set(water))
salt=list(set(salt))
stack=0
ans_sol=0
ans_sal=0
for i in water:
  for j in salt:
    if 1<=i+j<=f and j*100<=i*c:
      if j/(i+j)>stack:
        stack=j/(i+j)
        ans_sol=i+j
        ans_sal=j
print(ans_sol,ans_sal)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
ans=[]
for i in range(f//100//a +1):
  for j in range(f//100//b +1):
    if i*a*100+j*b*100<=f:
      for p in range(f//c +1):
        for q in range(f//d +1):
          if p*c+q*d<=(i*a+j*b)*e and (p*c+q*d+i*a*100+j*b*100<=f):
            ans.append([p*c+q*d+i*a*100+j*b*100,p*c+q*d])
stack=0
index=0
for i in range(len(ans)):
  if ans[i][1]!=0:
    if stack<ans[i][0]/ans[i][1]:
      stack=ans[i][0]/ans[i][1]
      index=i
if index==0:
  print(0,0)
else:
  print(ans[index][0],ans[index][1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0 and dp[i-j]!=-1:
      if 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
        dp[i]=max(dp[i],dp[i-j]+j)
      else:
        dp[i]=dp[i-1]
stack=0
index=min(a*100,b*100)
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<(dp[i]*100)/i:
      stack=(dp[i]*100)/i
      index=i
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0 and dp[i-j]!=-1 and 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
      dp[i]=max(dp[i],dp[i-j]+j)
stack=0
index=min(a*100,b*100)
for i in range(1,f+1):
  if dp[i]!=-1:
    if dp[i]/i>e/(100+e):
      dp[i]=-1
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<(dp[i]*100)/i:
      stack=(dp[i]*100)/i
      index=i
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0:
      if dp[i-j]!=-1 and 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
        dp[i]=max(dp[i],dp[i-j]+j)
stack=0
index=min(a*100,b*100)
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<(dp[i]*100)/i:
      stack=(dp[i]*100)/i
      index=i
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0 and dp[i-j]!=-1 and 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
      dp[i]=max(dp[i],dp[i-j]+j)
stack=0
index=min(a*100,b*100)
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<(dp[i]*100)/i:
      stack=(dp[i]*100)/i
      index=i
if index==min(a*100,b*100):
  print(min(a*100,b*100),0)
  exit()
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0 and dp[i-j]!=-1 and 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
      dp[i]=max(dp[i],dp[i-j]+j)
stack=0
index=min(a*100,b*100)
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<(dp[i]*100)/i:
      stack=(dp[i]*100)/i
      index=i
if index==min(a*100,b*100):
  print(min(a*100,b*100),0)
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0 and dp[i-j]!=-1 and 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
      dp[i]=max(dp[i],dp[i-j]+j)
stack=0
index=min(a*100,b*100)
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<(dp[i]*100)/i:
      stack=(dp[i]*100)/i
      index=i
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
dp=[-1]*(f+1)
dp[0]=0
for i in range(1,f+1):
  for j in [a*100,b*100]:
    if i-j>=0 and dp[i-j]!=-1:
      dp[i]=max(0,dp[i])
  for j in [c,d]:
    if i-j>=0 and dp[i-j]!=-1 and 100*(dp[i-j]+j)<=e*(i-(dp[i-j]+j)):
      dp[i]=max(dp[i],dp[i-j]+j)
stack=0
index=min(a*100,b*100)
for i in range(index+1,f+1):
  if dp[i]>0:
    if stack<dp[i]*100/(i-dp[i]):
      stack=dp[i]*100/(i-dp[i])
      index=i
print(index,dp[index])

Submission status: Wrong Answer

Solution code:
A , B , C , D , E , F = map(int, input().split())
# x = 100 * A * i + 100 * B * j
# y = C * k + D * l
xlist = []
for i in range( (F // (100*A))+1):
    for j in range((F // (100*B))+1):
        if (100 * A * i + 100 * B * j) <= F:
            xlist.append(100 * A * i + 100 * B * j)
ylist = []
for i in range((F // C)+1):
    for j in range((F // D)+1):
        if (C * i + D * j) <= F:
            ylist.append(C * i + D * j)
# 重量制限
# x + y <= F
# 濃度
# 100 * y //(x + y)
# 溶ける砂糖
# x * E >= y
tmp_n = 0.0 # 濃度
tmp_x = 0 # 水
tmp_y = 0 # 砂糖
for x in xlist:
    for y in ylist:
        if (x + y <= F) and ((x * E //100) >= y) and (x + y > 0):
            if tmp_n < (100 * y / (x + y)):
                tmp_n = (100 * y / (x + y))
                tmp_x = x
                tmp_y = y
                
print(tmp_x + tmp_y , tmp_y)
#print(xlist , ylist)

Submission status: Wrong Answer

Solution code:
A , B , C , D , E , F = map(int, input().split())
# x = 100 * A * i + 100 * B * j
# y = C * k + D * l
xlist = []
for i in range( (F // (100*A))+1):
    for j in range((F // (100*B))+1):
        if (100 * A * i + 100 * B * j) <= F:
            xlist.append(100 * A * i + 100 * B * j)
ylist = []
for i in range(F // C):
    for j in range(F // D):
        if (C * i + D * j) <= F:
            ylist.append(C * i + D * j)
# 重量制限
# x + y <= F
# 濃度
# 100 * y //(x + y)
# 溶ける砂糖
# x * E >= y
tmp_n = 0.0 # 濃度
tmp_x = 0 # 水
tmp_y = 0 # 砂糖
for x in xlist:
    for y in ylist:
        if (x + y <= F) and ((x * E //100) >= y) and (x + y > 0):
            if tmp_n < (100 * y / (x + y)):
                tmp_n = (100 * y / (x + y))
                tmp_x = x
                tmp_y = y
                
print(tmp_x + tmp_y , tmp_y)
#print(xlist , ylist)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
ans = [0,0,0]
for i in range(0,3000//(a*100)+1):
    for j in range(0,3000//(b*100)+1):
        g = i*a*100+j*b*100
        if i==j==0 or g>f:
            continue
        for k in range(0,(f-g)//c):
            for l in range(0,(f-g)//d):
                if g+k*c+l*d>f:
                    continue
                if ans[2]<(k*c+l*d)/(g+k*c+l*d) and k*c+l*d<=e*g/100:
                    ans[0] = g+k*c+l*d
                    ans[1] = k*c+l*d
                    ans[2] = (k*c+l*d)/(g+k*c+l*d)
print(ans[0],ans[1])