Problem:


Score : 300 points

Problem Statement

Snuke is making sugar water in a beaker.
Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.

Operation 1: Pour 100A grams of water into the beaker.

Operation 2: Pour 100B grams of water into the beaker.

Operation 3: Put C grams of sugar into the beaker.

Operation 4: Put D grams of sugar into the beaker.

In our experimental environment, E grams of sugar can dissolve into 100 grams of water.

Snuke will make sugar water with the highest possible density.

The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.
Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.
If there is more than one candidate, any of them will be accepted.

We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent.
Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.

Constraints

1 \leq A < B \leq 30

1 \leq C < D \leq 30

1 \leq E \leq 100

100A \leq F \leq 3 000

A, B, C, D, E and F are all integers.

Inputs

Input is given from Standard Input in the following format:

A B C D E F

Outputs

Print two integers separated by a space.
The first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.

Sample Input 1

1 2 10 20 15 200

Sample Output 1

110 10

In this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.

We can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.
It is not possible to make sugar water with higher density.
For example, the following sequences of operations are infeasible:

If we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.

If we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.

Sample Input 2

1 2 1 2 100 1000

Sample Output 2

200 100

There are other acceptable outputs, such as:

400 200

However, the output below is not acceptable:

300 150

This is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.

Sample Input 3

17 19 22 26 55 2802

Sample Output 3

2634 934



Sample input:
1 2 10 20 15 200


Sample output:
110 10

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
w_m=f//(100+e)*100
s_m=f//(100+e)*e
w=w_m//(100*a)*(100*a)
s=s_m//c*c
wn=w_m//(100*b)
noudo=0
answ=0
anss=0
for i in range(w_m//(a*100)+1):
    for j in range((w_m-i*a*100)//b+1):
        w=(i*a+j*b)*100
        if w==0:
            pass
        else:
            for k in range(s_m//c+1):
                for l in range((s_m-k*c)//d+1):
                    s=k*c+l*d
                    if (noudo<s/(s+w)) and (s/(s+w)<=e/(100+e)):
                        noudo=s/(s+w)
                        answ=w
                        anss=s

print(answ+anss,anss)

Submission status: Wrong Answer

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

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) >= ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

if ans != 0:
  print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))
else:
  print("0 0")

Submission status: Wrong Answer

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

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) >= ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

if ans != 0:
  print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))
else:
  print(str(A)+" 0")

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=[int(x) for x in input().split()]
a=100*a
b=100*b
ans = 0
v = 0
su = 0
for i in range(f//a+1):
  for j in range((f-a*i)//b+1):
    for k in range((e*(i*a//100+j*b//100))//c+1):
      for l in range((e*(a*i//100+j*b//100)-k*c)//d+1):
        #print(i,j,k,l)
        if (i!=0 or j!=0 or k!=0 or l!=0) and ans<(c*k+l*d)/(a*i+b*j+c*k+l*d) and (a*i+b*j+c*k+l*d)<=f:
          ans=(c*k+l*d)/(a*i+b*j+c*k+l*d)
          v = (a*i+b*j+c*k+l*d)
          su = c*k+l*d
print(v,su)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
tres = 0
res = [0,0]
for i in range(31):
    mass = i * 100*b
    if mass > f:
        break
    for j in range(31):
        mass = i * 100*b+100*a*j
        if mass > f:
            break
        if mass == 0:
            continue
        for k in range(101):
            mass = i * 100*b+100*a*j + k*d
            sugar = k*d
            l = min(int((mass - sugar)*e/100 - k*d)//c, (f - mass)//c)
            if l < 0: break
            mass += l * c
            sugar += l*c
            noudo = sugar / mass
            if noudo > tres:
                tres = noudo
                res[0] = mass
                res[1] = sugar
                
print(" ".join(map(str,res)))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
tres = 0
res = [0,0]
for i in range(31):
    mass = i * 100*b
    if mass > f:
        break
    for j in range(31):
        mass = i * 100*b+100*a*j
        if mass > f:
            break
        if mass == 0:
            continue
        for k in range(101):
            mass = i * 100*b+100*a*j + k*d
            sugar = k*d
            l = int(((mass - sugar)*e/100 - k*d)//c)
            if l < 0: break
            mass += l * c
            sugar += l*c
            if mass > f:
                break
            noudo = sugar / mass
            if noudo > tres:
                tres = noudo
                res[0] = mass
                res[1] = sugar
                
print(" ".join(map(str,res)))

Submission status: Wrong Answer

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

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            j+=1
            continue
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e)+1)
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if 100*s/(s+w)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
            max_per=100*s/(s+w)
print('{} {}'.format(ans_w+ans_s,ans_s))

Submission status: Wrong Answer

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

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            j+=1
            continue
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e))
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if 100*s/(s+w)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
            max_per=100*s/(s+w)
print('{} {}'.format(ans_w+ans_s,ans_s))

Submission status: Wrong Answer

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

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            j+=1
            continue
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e))
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if s/(w/100)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
print('{} {}'.format(ans_w+ans_s,ans_s))

Submission status: Wrong Answer

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

dic_w={}
i=0
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w==0:
            break
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e))
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if s/(w/100)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
print('{} {}'.format(ans_w+ans_s,ans_s))

Submission status: Wrong Answer

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

dic_w={}
i=1
while True:
    if (a*i*100)>f:
        break
    j=0
    while True:
        w=(a*i+b*j)*100
        if w>f:
            break
        else:
            dic_w[w]=dic_w.get(w,0)+1
        j+=1
    i+=1
list_w=list(dic_w.keys())
list_w.sort()

dic_s={}
max_s=int(e*f/(100+e))
i=0
while True:
    if c*i>max_s:
        break
    j=0
    while True:
        s=c*i+d*j
        if s>max_s:
            break
        else:
            dic_s[s]=dic_s.get(s,0)+1
        j+=1
    i+=1
list_s=list(dic_s.keys())
list_s.sort()

max_per=0
flag=False
ans_w=0
ans_s=0
for w in list_w:
    if flag==True:
        break
    for s in list_s:
        if s/(w/100)==e and s+w<=f:
            ans_w=w
            ans_s=s
            flag=True
            break
        if s/(w/100)>e:
            break
        if s/(w/100)>max_per and s+w<=f:
            ans_w=w
            ans_s=s
print('{} {}'.format(ans_w+ans_s,ans_s))

Submission status: Wrong Answer

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

water = []
sugar =[]
ans = [0] * 3
for i in range(F+1):
    for j in range(F+1):
        y = i * C + j * D
        if y <= F:
            sugar.append(y)

for i in range(F + 1):
    for j in range(F + 1):
        x = i * 100 * A + j * 100 * B
        if x <= F:
            water.append(x)

for i in range(len(water)):
    for j in range(len(sugar)):
        a = water[i]
        b = sugar[j]
        if a + b <= F and a / 100 * E >= b:
            if ans[0] * (a + b) < 100 * b:
                ans[0] = 100 * b / (a + b)
                ans[1] = a + b
                ans[2] = b
print("{} {}".format(ans[1], ans[2]))

Submission status: Wrong Answer

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

# 操作1ができる最大の回数
cnt1 = F // (100 * A)
# 濃度,砂糖水の質量, 砂糖の量
ans = [0] * 3

for i in range(cnt1 + 1):
    cnt2 = (F - 100 * i) // 100
    for j in range(cnt2 + 1):
        cnt3 = (i + j) * E // C
        for k in range(cnt3 + 1):
            cnt4 = ((i + j) * E - (C * k)) // D
            for l in range(cnt4 + 1):
                # 条件は　(100*A+100*B) / 100 * E > x * C + y * D
                a = 100*i+100*j
                b = k * C + l * D
                if ((a / 100) * E) > b and (a + b) <= F:
                    if ans[0] < ((100 * b) / (a + b)):
                        ans[0] =  (100 * b) / (a + b)
                        ans[1] = a + b
                        ans[2] = b
print("{} {}".format(ans[1],ans[2]))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
cmax = 0
x = 0
y = 0
for n in range(F//(100*A)+1):
    for m in range((F-n*100*A)//(100*B)+1):
        for l in range((F-n*100*A-m*100*B)//C+1):
            for k in range((F-n*100*A-m*100*B-l*C)//D+1):
#                 print("n,m,l,k={},{},{},{}".format(n,m,l,k))
                if n**2+m**2>0 and l*C+k*D<=E*(n*A+m*B):
#                     print("d={}".format((l*C+k*D)/(n*100*A+m*100*B+l*C+k*D)))
                    if cmax<(l*C+k*D)/(n*100*A+m*100*B+l*C+k*D):
                        cmax = (l*C+k*D)/(n*100*A+m*100*B+l*C+k*D)
                        x = n*100*A+m*100*B
                        y = l*C+k*D
                    
print(x+y,y)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int,input().split( ))
mx = 0
ans = [0,0]
for i in range(f//(a*100)+1):
    sup_b = f-i*a*100
    
    for j in range(sup_b//(b*100)+1):
        wat = i*a*100 + j*b*100
        
        if wat > f or not wat:
            continue
        sup_sug = min(e*(wat/100), f - wat)

        
        for k in range(int(sup_sug//c)+1):
            l = (sup_sug - k*c)//d
            
            if (k*c + l*d)/wat > e/100:
                continue
                
            if mx < (k*c + l*d)/wat:
                mx = (k*c + l*d)/wat
                ans = [(k*c + l*d) + wat, k*c + l*d]
if int(ans[0])==0 and int(ans[1])==0:
    print(f,0)
else:
    print(int(ans[0]),int(ans[1]))

Submission status: Wrong Answer

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

    max_sugar = F * E / (100 + E)
    max_water = F - max_sugar

    ans_per = 0
    ans_water_sugar = 0
    ans_sugar = 0

    for a in range(int(max_water // A) + 1):
        a_water = A * a
        tmp_water = max_water - a_water
        for b in range(int(tmp_water // B) + 1):
            b_water = B * b
            res_water = a_water + b_water
            mm_sugar = res_water * E / 100
            for c in range(int(mm_sugar // C) + 1):
                c_sugar = C * c
                tmp_sugar = mm_sugar - c_sugar
                for d in range(int(tmp_sugar // D) + 1):
                    d_sugar = D * d
                    res_sugar = c_sugar + d_sugar
                    per = res_sugar / res_water if res_water != 0 else 0
                    if res_water != 0 and ans_per <= per and per <= E / 100:
                        ans_per = per
                        ans_water_sugar = res_water + res_sugar
                        ans_sugar = res_sugar
    if ans_water_sugar == 0:
        ans_water_sugar = A
    print(ans_water_sugar, ans_sugar)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:


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

    max_sugar = F * E / (100 + E)
    max_water = F - max_sugar

    ans_per = 0
    ans_water_sugar = 0
    ans_sugar = 0

    for a in range(int(max_water // A) + 1):
        a_water = A * a
        tmp_water = max_water - a_water
        for b in range(int(tmp_water // B) + 1):
            b_water = B * b
            res_water = a_water + b_water
            mm_sugar = res_water * E / 100
            for c in range(int(mm_sugar // C) + 1):
                c_sugar = C * c
                tmp_sugar = mm_sugar - c_sugar
                for d in range(int(tmp_sugar // D) + 1):
                    d_sugar = D * d
                    res_sugar = c_sugar + d_sugar
                    if res_water != 0 and ans_per <= res_sugar / res_water:
                        ans_per = res_sugar / res_water
                        ans_water_sugar = res_water + res_sugar
                        ans_sugar = res_sugar
    if ans_water_sugar == 0: 
        ans_water_sugar = A
    print(ans_water_sugar, ans_sugar)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:


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

    max_sugar = F * E / (100 + E)
    max_water = F - max_sugar

    ans_per = 0
    ans_water_sugar = 0
    ans_sugar = 0

    for a in range(int(max_water // A) + 1):
        a_water = A * a
        tmp_water = max_water - a_water
        for b in range(int(tmp_water // B) + 1):
            b_water = B * b
            res_water = a_water + b_water
            mm_sugar = res_water * E / 100
            for c in range(int(mm_sugar // C) + 1):
                c_sugar = C * c
                tmp_sugar = mm_sugar - c_sugar
                for d in range(int(tmp_sugar // D) + 1):
                    d_sugar = D * d
                    res_sugar = c_sugar + d_sugar
                    if res_water != 0 and ans_per <= res_sugar / res_water:
                        ans_per = res_sugar / res_water
                        ans_water_sugar = res_water + res_sugar
                        ans_sugar = res_sugar

    print(ans_water_sugar, ans_sugar)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:


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

    max_sugar = F * E / (100 + E)
    max_water = F - max_sugar

    ans_per = -1
    ans_water_sugar = 0
    ans_sugar = 0

    for a in range(int(max_water // A) + 1):
        a_water = A * a
        tmp_water = max_water - a_water
        for b in range(int(tmp_water // B) + 1):
            b_water = B * b
            res_water = a_water + b_water
            mm_sugar = res_water * E / 100
            for c in range(int(mm_sugar // C) + 1):
                c_sugar = C * c
                tmp_sugar = mm_sugar - c_sugar
                for d in range(int(tmp_sugar // D) + 1):
                    d_sugar = D * d
                    res_sugar = c_sugar + d_sugar
                    if res_water != 0 and ans_per <= res_sugar / res_water:
                        ans_per = res_sugar / res_water
                        ans_water_sugar = res_water + res_sugar
                        ans_sugar = res_sugar

    print(ans_water_sugar, ans_sugar)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

total = 0
sugar = 0
max_concentration = 0

for i in range(f//(100*a)+1):
    for j in range(f//(100*b)+1):
        for k in range(f//c+1):
            for l in range(f//d+1):
                if 0 < 100*(a*i+b*j)+(c*k+d*l)<=f and c*k+d*l<=e*(a*i+b*j):
                    if max_concentration < (c*k+d*l)/(100*(a*i+b*j)+(c*k+d*l)):
                        max_concentration = (c*k+d*l)/(100*(a*i+b*j)+(c*k+d*l))
                        total = 100*(a*i+b*j)+(c*k+d*l)
                        sugar = (c*k+d*l)
print(total,sugar)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int,input().split( ))
mx = 0
ans = [0,0]
for i in range(f//(a*100)+1):
    sup_b = f-i*a*100
    
    for j in range(sup_b//(b*100)+1):
        wat = i*a*100 + j*b*100
        
        if wat > f or not wat:
            continue
        sup_sug = min(e*(wat/100), f - wat)

        
        for k in range(int(sup_sug//c)+1):
            l = (sup_sug - k*c)//d
            
            if (k*c + l*d)/wat > e/100:
                continue
                
            if mx < (k*c + l*d)/wat:
                mx = (k*c + l*d)/wat
                ans = [(k*c + l*d) + wat, k*c + l*d]

print(int(ans[0]),int(ans[1]))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
A *= 100
B *= 100
check = -1
for i in range(F//A+1):
    for j in range((F-(A*i))//B+1):
        if i == 0 and j == 0:continue
        for k in range((F-(A*i)-(B*j))//C+1):
            for l in range((F-(A*i)-(B*j)-(C*k))//D+1):
                water = A*i+B*j
                sugar = C*k+D*l
                if sugar > water//100*E:continue
                if check < sugar / (water+sugar):
                    check = sugar / (water+sugar)
                    ans = [water+sugar,sugar]
print(ans)

Submission status: Wrong Answer

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

def dence(a,b,c,d):
  return a*A+b*B+c*C+d*D


for a in range(F//A+1):
  for b in range(F-a*100//B+1):
    for c in range((F-a*A-b*B)//C+1):
      for d in range((F-a*A-b*B-c*C)//D+1):
        if (a*A+b*B)*E/100 >= c*C+d*D and any(i for i in [a,b,c,d]):
          
          if 100*(c*C+d*D)/(a*A+b*B+c*C+d*D) > den:
            #print(a,b,c,d)
            den = 100*(c*C+d*D)/(a*A+b*B+c*C+d*D)
            #print(den)
            ans = [a*A+b*B+c*C+d*D, c*C+d*D]
print(ans[0], ans[1])

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
noudo = E/(100+E)
_=min(A,B)
max_noudo=0
ans_weight=0
ans_suger=0
def chksg(s,C,D):
    i=s//C
    j=s//D
    for _i in range(i+1):
        for _j in range(j+1):
            if s == C*_i + D*_j:
                return True
    return False
def chkwt(s,A,B):
    i=s//(A//100)
    j=s//(B//100)
    for _i in range(i+1):
        for _j in range(j+1):
            if s == A*_i + B*_j:
                return True
    return False
for water in range(100*_,F+1,100):
    if not chkwt(water,A*100,B*100):
        continue
    for suger in range(F-water,0,-1):
        temp_noudo = suger/(water+suger)
        if temp_noudo>noudo:
            continue
        elif chksg(suger,C,D):
            if max_noudo<temp_noudo:
                max_noudo=temp_noudo
                ans_weight = water+suger
                ans_suger = suger
            if temp_noudo == noudo:
                print(ans_weight,ans_suger)

print(ans_weight,ans_suger)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
noudo = E/(100+E)
_=min(A,B)
max_noudo=0
ans_weight=0
ans_suger=0
def chksg(s,C,D):
    i=s//C
    j=s//D
    for _i in range(i+1):
        for _j in range(j+1):
            if s == C*_i + D*_j:
                return True
    return False
def chkwt(s,A,B):
    i=s//(A//100)
    j=s//(B//100)
    for _i in range(i+1):
        for _j in range(j+1):
            if s == A*_i + B*_j:
                return True
    return False
for water in range(100*_,F+1,100):
    if not chkwt(water,A*100,B*100):
        continue
    for suger in range(F-water,0,-1):
        temp_noudo = suger/(water+suger)
        if temp_noudo>noudo:
            continue
        elif chksg(suger,C,D):
            if max_noudo<temp_noudo:
                max_noudo=temp_noudo
                ans_weight = water+suger
                ans_suger = suger
            if temp_noudo == noudo:
                print(ans_weight,ans_suger)
                exit()

print(ans_weight,ans_suger)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
noudo = E/(100+E)
_=min(A,B)
max_noudo=0
ans_weight=0
ans_suger=0
def chk(s,C,D):
    i=s//C
    j=s//D
    for _i in range(i+1):
        for _j in range(j+1):
            if s == C*_i + D*_j:
                return True
    return False
for water in range(100*_,F+1,100):
    if not chk(water,A*100,B*100):
        continue
    for suger in range(F-water,0,-1):
        temp_noudo = suger/(water+suger)
        if temp_noudo>noudo:
            continue
        elif chk(suger,C,D):
            if max_noudo<temp_noudo:
                max_noudo=temp_noudo
                ans_weight = water+suger
                ans_suger = suger
            if temp_noudo == noudo:
                print(ans_weight,ans_suger)

print(ans_weight,ans_suger)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
noudo = E/(100+E)
_=min(A,B)
max_noudo=0
ans_weight=0
ans_suger=0
def chk(s,C,D):
    i=s//C
    j=s//D
    for _i in range(i+1):
        for _j in range(j+1):
            if s == C*_i + D*_j:
                return True
    return False
for water in range(100*_,F+1,100):
    if not chk(water,A*100,B*100):
        continue
    for suger in range(F-water,0,-1):
        temp_noudo = suger/(water+suger)
        if temp_noudo>noudo:
            continue
        elif chk(suger,C,D):
            if max_noudo<temp_noudo:
                max_noudo=temp_noudo
                ans_weight = water+suger
                ans_suger = suger
            if temp_noudo == noudo:
                print(ans_weight,ans_suger)
                exit()

print(ans_weight,ans_suger)

Submission status: Wrong Answer

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

for i in range(1, F // (100 * A) + 1):
    water1 = i * 100 * A
    for j in range((F - water1) // (100 * B) + 1):
        water2 = j * 100 * B
        water.add(water1 + water2)

ans = [100 * A, 0]
c = 0

for i in water:
    max_sugar = i // 100 * E
    sugar = [0]
    for j in range(max_sugar // C + 1):
        for k in range((max_sugar - j * C) // D + 1):
            sugar.append(j * C + k * D)
    max_sugar = max(sugar)
    concentration = max_sugar / (i + max_sugar)
    if c < concentration:
        c = concentration
        ans = [i + max_sugar, max_sugar]

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

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

def calc(w,s):
    sugar=0
#    while sugar/(w+sugar)<=e/(100+e) and w+sugar<=f:
    while sugar/w <= e/100 and w+sugar<=f:
        sugar+=s
    return w,sugar-s

w1,s1=calc(100*a,c)
w2,s2=calc(100*a,d)
w3,s3=calc(100*b,c)
w4,s4=calc(100*b,d)

#print(w1,s1,w2,s2,w3,s3,w4,s4)

ansx=0
ansy=0
mol=0
for i in range(30):
    for j in range(30):
        for k in range(30):
            for l in range(30):
                sugar=s1*i+s2*j+s3*k+s4*l
                solvent=sugar+w1*i+w2*j+w3*k+w4*l
#                print(sugar,solvent)
                if solvent!=0 and sugar/solvent<=e/(100+e) and solvent<=f:
                    if mol < (100*sugar)/solvent:
                        ansx=solvent
                        ansy=sugar
                        mol=(100*sugar)/solvent
print(ansx,ansy)

Submission status: Wrong Answer

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

def calc(w,s):
    sugar=0
#    while sugar/(w+sugar)<=e/(100+e) and w+sugar<=f:
    while sugar/w <= e/100 and w+sugar<=f:
        sugar+=s
    return w,sugar-s

w1,s1=calc(100*a,c)
w2,s2=calc(100*a,d)
w3,s3=calc(100*b,c)
w4,s4=calc(100*b,d)

print(w1,s1,w2,s2,w3,s3,w4,s4)

ansx=0
ansy=0
mol=0
for i in range(30):
    for j in range(30):
        for k in range(30):
            for l in range(30):
                sugar=s1*i+s2*j+s3*k+s4*l
                solvent=sugar+w1*i+w2*j+w3*k+w4*l
#                print(sugar,solvent)
                if solvent!=0 and sugar/solvent<=e/(100+e) and solvent<=f:
                    if mol < (100*sugar)/solvent:
                        ansx=solvent
                        ansy=sugar
                        mol=(100*sugar)/solvent
print(ansx,ansy)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans = [100 * A] * 2
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = 100 * A * i + 100 * B * j
        if a > F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a) // D + 1):
                b = k * C + l * D
                concentration = 100 * b / (a + b)
                if (A * i + B * j) * E >= b and a + b <= F:
                    if concentration > c:
                        c = concentration
                        ans = [a + b, b]
                else:
                    break

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans = [0] * 2
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = 100 * A * i + 100 * B * j
        if a > F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a) // D + 1):
                b = k * C + l * D
                concentration = 100 * b / (a + b)
                if (A * i + B * j) * E >= b and a + b <= F:
                    if concentration > c:
                        c = concentration
                        ans = [a + b, b]
                else:
                    break

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans = [0] * 2
c = 0.0

for i in range(1, F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = 100 * A * i + 100 * B * j
        if a > F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a) // D + 1):
                b = k * C + l * D
                concentration = 100 * b / (a + b)
                if (A * i + B * j) * E >= b and a + b <= F:
                    if concentration > c:
                        c = concentration
                        ans = [a + b, b]
                else:
                    break

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans = [0] * 2
c = 0

for i in range(1, F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = 100 * A * i + 100 * B * j
        if a > F:
            break
        for k in range((F - a) // C + 1):
            for l in range((F - a) // D + 1):
                b = k * C + l * D
                concentration = 100 * b / (a + b)
                if (A * i + B * j) * E >= b and a + b <= F and c < concentration:
                    c = concentration
                    ans = [a + b, b]
                else:
                    break

print(' '.join(map(str, ans)))