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())
x = set()
y = set()
for A in range(0, f + 1, 100 * a):
    for B in range(0, f + 1, 100 * b):
        if A + B > f:
            break
        if A + B:
            x.add(A + B)
for C in range(0, f + 1, c):
    for D in range(0, f + 1, d):
        if C + D > f:
            break
        y.add(C + D)
ans = 0
w = 0
s = 0
for X in x:
    for Y in y:
        if X + Y <= f and 100 * Y / X <= e:
                if ans < 100 * Y / (X + Y):
                    ans = 100 * Y / (X + Y)
                    w = X
                    s = Y
print(w + s, s)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
x = set()
y = set()
for A in range(0, f + 1, 100 * a):
    for B in range(0, f + 1, 100 * b):
        if A + B > f:
            break
        x.add(A + B)
for C in range(0, f + 1, c):
    for D in range(0, f + 1, d):
        if C + D > f:
            break
        y.add(C + D)
ans = 0
w = 0
s = 0
for X in x:
    for Y in y:
        if X + Y <= f and Y > 0 and X >= Y:
            if Y / (X + Y) <= e / (100 + e):
                if ans < 100 * Y / (X + Y):
                    ans = 100 * Y / (X + Y)
                    w = X
                    s = Y
print(w + s, s)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
x = set()
y = set()
for i in range(f // 100 + 1):
    for j in range(f // 100 + 1):
        if 100 * a * i + 100 * b * j > f:
            break
        x.add(100 * a * i + 100 * b * j)
for i in range(f + 1):
    for j in range(f + 1):
        if c * i + d * j > f:
            break
        y.add(c * i + d * j)
ans = 0
w = 0
s = 0
for X in x:
    for Y in y:
        if X + Y <= f and Y > 0 and X >= Y:
            if Y / (X + Y) <= e / (100 + e):
                if ans < 100 * Y / (X + Y):
                    ans = 100 * Y / (X + Y)
                    w = X
                    s = Y
print(w + s, s)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
x = set()
y = set()
for i in range(f // 100 + 1):
    for j in range(f // 100 + 1):
        if 100 * a * i + 100 * b * j > f:
            break
        x.add(100 * a * i + 100 * b * j)
for i in range(f + 1):
    for j in range(f + 1):
        if c * i + d * j > f:
            break
        y.add(c * i + d * j)
ans = 0
w = 0
s = 0
for X in x:
    for Y in y:
        if X + Y <= f and Y > 0 and X >= Y:
            if 100 * Y / (X + Y) <= e:
                if ans < 100 * Y / (X + Y):
                    ans = 100 * Y / (X + Y)
                    w = X
                    s = Y
print(w + s, s)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
ans = 1, 0
w = set()
for a in range(0, F + 1, 100 * A):
    for b in range(0, F - a + 1, 100 * B):
        if a + b:
            w.add(a + b)
s = set()
for c in range(0, F + 1, C):
    for d in range(0, F + 1 - c, D):
        s.add(c + d)
for wi in w:
    for sj in s:
        conc = 100 * sj / (wi + sj)
        if wi + sj <= F and 100 * sj / wi <= E:
            ans = max(ans, (wi + sj, sj), key=lambda x: x[1] / x[0])

print(*ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
line = input().split()
a = int(line[0]) #水100a[g]
b = int(line[1]) #水100b[g]
c = int(line[2]) #砂糖c[g]
d = int(line[3]) #砂糖d[g]
e = int(line[4]) #水100gに溶ける砂糖e[g]
f = int(line[5]) #質量f[g]

ra = 1
rb = 0
for ai in range(f//(100*a)+2):
    for bi in range(f//(100*b)+2):
        if 100*a*ai+100*b*bi>f:
            continue
        for ci in range(f//c+2):
            if 100*a*ai+100*b*bi+c*ci>f:
                continue
            elif c*ci>(a*ai+b*bi)*e:
                continue
            for di in range(f//d+2):
                sa = 100*a*ai+100*b*bi
                sb = c*ci+d*di
                if sa+sb>f:
                    continue
                elif sb>(a*ai+b*bi)*e:
                    continue
                elif sa+sb==0:
                    continue
                if sb/(sa+sb) > rb/(ra+rb):
                    ra = sa
                    rb = sb
                    # print("---")
                    # print(ra,rb)
                    # print(ai,bi,ci,di)

print(ra+rb,rb)

Submission status: Wrong Answer

Solution code:

a,b,c,d,e,f=map(int,input().split())
ans=0
s=0
t=0
for i in range(f//100+1):
    w=(f-100*a*i)//100
    for j in range(w+1):
        if i==0 and j==0:
            continue
        x=a*i+b*j
        for k in range(x*e//c+1):
            v=(x*e-c*k)//d
            for l in range(v+1):
                y=c*k+d*l
                if 100*x+y <=f:
                    p=100*y/(100*x+y)
                    if ans<p:
                        s=100*x+y
                        t=y
                        ans=p
print(s,t)

Submission status: Wrong Answer

Solution code:

a,b,c,d,e,f=map(int,input().split())
ans=0
s=0
t=0
for i in range(f//100+1):
    w=(f-100*a*i)//100
    for j in range(w+1):
        if i==0 and j==0:
            continue
        x=a*i+b*j
        for k in range(x*e//c+1):
            v=(x*e-c*k)//d
            for l in range(v+1):
                if k==0 and l==0:
                    continue
                y=c*k+d*l
                if 100*x+y <=f:
                    p=100*y/(100*x+y)
                    if ans<p:
                        s=100*x+y
                        t=y
                        ans=p
print(s,t)

Submission status: Wrong Answer

Solution code:

a,b,c,d,e,f=map(int,input().split())
ans=0
s=0
t=0
for i in range(f//100+1):
    w=(f-100*a*i)//100
    for j in range(w+1):
        if i==0 and j==0:
            continue
        x=a*i+b*j
        for k in range(x*e//c+1):
            v=(x*e-c*k)//d
            for l in range(v+1):
                if k==0 and l==0:
                    continue
                y=c*k+d*l
                if 100*x+y <=f:
                    p=100*y/(100*x+y)
                    if ans<p:
                        s=100*x+y
                        t=y
print(s,t)

Submission status: Wrong Answer

Solution code:
import sys
a,b,c,d,e,f=map(int,input().split())
ans=0
s=0
t=0
for i in range(31):
    for j in range(31):
        x=a*i+b*j
        if i==0 and j==0:
            continue
        if 100*x <=f:
            for k in range(101):
                for l in range(101):
                    if k==0 and l==0:
                        continue
                    y=c*k+d*l
                    if y<=x*e and 100*x+y <=f:
                        p=100*y/(100*x+y)
                        if ans<p:
                            s=100*x+y
                            t=y
print(s,t)

Submission status: Wrong Answer

Solution code:
import sys
a,b,c,d,e,f=map(int,input().split())
for i in range(31):
    for j in range(31):
        x=a*i+b*j
        if i==0 and j==0:
            continue
        if 100*x <=f:
            for k in range(101):
                for l in range(101):
                    if k==0 and l==0:
                        continue
                    y=c*k+d*l
                    if y<=x*e and 100*x+y <=f:
                        print(100*x+y,y)
                        sys.exit()

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = list(map(int,input().split()))
ans = []
g = 0
for i in range(f//(a*100)+1):
    for j in range((f-a*i*100)//(b*100)+1):
        for k in range(min((f-a*i*100-b*j*100)//c,e*(a*i+b*j)//c)+1):
            l = (e*(a*i+b*j) - k*c)//d
            if (a*i*100+b*j*100+c*k+d*l)>0 and (a*i*100+b*j*100+c*k+d*l)<=f:
                if g < (k*c+d*l)/(a*i*100+b*j*100+c*k+d*l):
                    g = (k*c+d*l)/(a*i*100+b*j*100+c*k+d*l)
                    ans = [a*i*100+b*j*100+c*k+d*l,k*c+d*l]
if len(ans) == 0:
    print(min(a,b)*100,0)
else:
    print(' '.join(map(str,ans)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = list(map(int, input().split()))
ans1, ans2 = 0, 0
t = 0
for i in range(31):
  for j in range(31):
    if i==j==0:
      break
    w = (a*i+b*j)*100
    if w>f:
      break
    for k in range((f-w)//c+1):
      for l in range((f-w)//d+1):
        s = c*k+d*l
        if w+s>f:
          break
        if w/100*e<s:
          break
        if t<100*s/(w+s):
          ans1 = w+s
          ans2 = s
          t = 100*s/(w+s)
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

MAX_K = 5000

ans = 0
tot = 0
rate = 0
F = [False] * MAX_K
G = [False] * MAX_K

if __name__ == "__main__":
    global a, b, c, d, e, f
    a, b, c, d, e, f = map(int, input().split())
    F[0] = 1
    G[0] = 1
    for i in range(0, f):
        if F[i]:
            if i + a <= f:
                F[i + a] = True
            if i + b <= f:
                F[i + b] = True
        if G[i]:
            if i + c <= f:
                G[i + c] = True
            if i + d <= f:
                G[i + d] = True
    i = 1
    while i * 100 <= f:
        if F[i]:
            j = 0
            while i * 100 + j <= f and j <= i * e:
                if G[j]:
                    r = 100.0 * j / (i * 100.0 + j)
                    if r > rate:
                        rate = r
                        tot = i * 100 + j
                        ans = j
                j += 1
        i += 1
    print(" ".join(map(str, (tot, ans))))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b < 1 or F <= 100*(A*a + B*b):
      break
    for c in range(1 + min(((A*a+B*b)*E)//C,F-100*(A*a+B*b))):
      for d in range(1 + min(((A*a+B*b)*E-C*c)//D,F-100*(A*a+B*b)-C*c)):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (100*tmp_sug/tmp)
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b < 1 or F <= 100*(A*a + B*b):
      break
    for c in range(1 + min(((A*a+B*b)*E)//C,F-100*(A*a+B*b))):
      for d in range(1 + min(((A*a+B*b)*E-C*c)//D,F-100*(A*a+B*b)-C*c)):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (100*tmp_sug/tmp)
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(2 + F//(100*A)):
  for b in range(2 + (F-100*A*a)//(100*B)):
    if a + b < 1 or F <= 100*(A*a + B*b):
      break
    for c in range(2 + min(((A*a+B*b)*E)//C,F-100*(A*a+B*b))):
      for d in range(2 + min(((A*a+B*b)*E-C*c)//D,F-100*(A*a+B*b)-C*c)):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (tmp_sug/tmp)*100
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b < 1 or F <= 100*(A*a + B*b):
      break
    for c in range(1 + min(((A*a+B*b)*E)//C,F-100*(A*a+B*b))):
      for d in range(1 + min(((A*a+B*b)*E-C*c)//D,F-100*(A*a+B*b)-C*c)):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (tmp_sug/tmp)*100
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b == 0 or F < 100*(A*a + B*b):
      break
    for c in range(3 + ((A*a+B*b)*E)//C):
      for d in range(3 + ((A*a+B*b)*E-C*c)//D):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (tmp_sug/tmp)*100
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b == 0 or F < 100*(A*a + B*b):
      break
    for c in range(1 + ((A*a+B*b)*E)//C):
      for d in range(1 + ((A*a+B*b)*E-C*c)//D):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (tmp_sug/tmp)*100
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + (F-100*A*a)//(100*B)):
    if a + b == 0 or F < 100*(A*a + B*b) + sug:
      break
    for c in range(1 + ((A*a+B*b)*E)//C):
      for d in range(1 + ((A*a+B*b)*E-C*c)//D):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (100*tmp_sug/tmp):
          conc = (tmp_sug/tmp)*100
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug = 0,0
for a in range(1 + F//(100*A)):
  for b in range(1 + F//(100*B)):
    if a+b==0 or F < 100*(A*a + B*b):
      break
    for c in range(1 + ((A*a+B*b)*E)//C):
      for d in range(1 + ((A*a+B*b)*E)//D):
        tmp_sug = C*c+D*d
        tmp = 100*(A*a+B*b)+tmp_sug
        if tmp <= F and tmp_sug <= (A*a+B*b)*E and conc < (tmp_sug/tmp)*100:
          conc = (tmp_sug/tmp)*100
          liq = tmp
          sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug=0,0
for a in range(1 + F//100):
  for b in range(a+1,(F//100)-a+1):
    for c in range(1+(((A*a+B*b)*E)//C)):
      for d in range(1 + ((A*a+B*b)*E-C*c)//D):
        tmp_liq = 100*(A*a+B*b)+C*c+D*d
        tmp_sug = C*c+D*d
        if tmp_liq <= F and  tmp_sug <= (A*a+B*b)*E:
          if conc < 100*tmp_sug/tmp_liq:
            conc = 100*tmp_sug/tmp_liq
            liq = tmp_liq
            sug = tmp_sug
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug=0,0
for a in range(31):
  for b in range(16):
    for c in range(1+(((F//100)*E)//C)):
      for d in range(1+(((F//100)*E)//D)):
        if 0 < a+b+c+d and 100*(A*a+B*b)+C*c+D*d <= F and  C*c+D*d <= (A*a+B*b)*E:
          if conc < 100*(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            conc = 100*(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d)
            liq = 100*(A*a+B*b)+C*c+D*d
            sug = C*c+D*d
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug=0,0
for a in range(31):
  for b in range(16):
    for c in range(1+(((F//100)*E)//C)):
      for d in range(1+(((F//100)*E)//D)):
        if 0 < a+b+c+d and 100*(A*a+B*b)+C*c+D*d <= F and  C*c+D*d <= (A*a+B*b)*E:
          if conc < 100*(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            conc = 100*(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d)
            liq = 100*(A*a+B*b)+C*c+D*d
            sug = C*c+D*d
print(liq,sug)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
conc = 0.0
liq,sug=0,0
for a in range(31):
  for b in range(16):
    for c in range(31):
      for d in range(31):
        if 0 < a+b+c+d and 100*(A*a+B*b)+C*c+D*d <= F and  C*c+D*d <= (A*a+B*b)*E:
          if conc < 100*(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            conc = 100*(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d)
            liq = 100*(A*a+B*b)+C*c+D*d
            sug = C*c+D*d
print(liq,sug)

Submission status: Wrong Answer

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

water_mass = []
for i in range(f // (100 * b) + 1):
	for j in range(f // (100 * a) + 1):
		if 0 < 100 * b * i + 100 * a * j <= f and 100 * b * i + 100 * a * j not in water_mass:
			water_mass.append(100 * b * i + 100 * a * j)

ans_gross = 0
ans_sugar = 0
c_max = 0
c_lim = e / (100 + e)

for water in water_mass:
	for i in range((f - water) // d + 1):
		for j in range((f - water - i * d) // c + 1):
			if i != 0 or j != 0:
				if c_max < (j * c + i * d) / (j * c + i * d + water) <= c_lim:
					c_max = (j * c + i * d) / (j * c + i * d + water)
					ans_sugar = j * c + i * d 
					ans_gross = ans_sugar + water

print(ans_gross, ans_sugar)

Submission status: Wrong Answer

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

noudo=0
mizu=0
satou=0

an=int(f/100*a)+1

for i in range(an):
  bn=int((f-100*a*i)/(100*b))+1
  
  for j in range(bn):
    cn=int((f -100*a*i -100*b*j)/c)+1
    
    for k in range(cn):
      dn=int((f -100*a*i -100*b*j -c*k)/d)+1
      
      for l in range(dn):
        
        if 100*i*a + 100*j*b + k*c + l*d != 0 and 100*i*a + 100*j*b + k*c + l*d <= f:
          if noudo <  100*(k*c+l*d)/ (100*i*a + 100*j*b + k*c + l*d) <= 100*e/(100+e):
            noudo = 100 * (k*c+l*d) / (100*i*a + 100*j*b + k*c + l*d)
            mizu = 100*i*a + 100*j*b
            satou =  k*c+l*d

print(mizu+satou, satou)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

input=raw_input()
list=input.split(" ")
for i in range(len(list)):
    list[i]=int(list[i])

e=list[4]
f=list[5]

# 1 2 10 20 15 200
# 17 19 22 26 55 2802

# xが取り得る値
listx=[]
a=list[0]
b=list[1]

i=0
while True:
   if i*a*100>f:
       break
   j=0
   while True:
      x=i*a*100+j*b*100
      if x>f:
          break;
      if x==0:
          j+=1
          continue;
      if x not in listx:
          listx.append(int(x))
      j+=1 
   i+=1 

# yが取り得る値
listy=[]
c=list[2]
d=list[3]

# yが水に溶け切れる最大値
f2=f*e/(100.0+e)

i=0
while True:
   if i*c>f2:
       break
   j=0
   while True:
      y=i*c+j*d
      if y>f2:
          break;
      if y not in listy:
          listy.append(int(y))
      j+=1 
   i+=1 

# 全てのxとyの組み合わせについてfを超えないか、および溶け切れるかを調べる
lengthx=len(listx)
lengthy=len(listy)

xy_max=0
y_max=0
noudo_max=0

for i in range(lengthx):
    for j in range(lengthy):
        x=listx[i]
        y=listy[j]
        if x+y>f:
            continue
        if float(y)*100/float(x)<=e:
            noudo=float(y)/(x+y)
            if noudo>noudo_max:
                xy_max=x+y
                y_max=y
                noudo_max=noudo

message=str(xy_max)+" "+str(y_max)
print message

Submission status: Wrong Answer

Solution code:
# coding:utf-8

input=raw_input()
list=input.split(" ")
for i in range(len(list)):
    list[i]=int(list[i])

e=list[4]
f=list[5]

# 1 2 10 20 15 200

# xが取り得る値
listx=[]
a=list[0]
b=list[1]

i=0
while True:
   if i*a*100>f:
       break
   j=0
   while True:
      x=i*a*100+j*b*100
      if x>f:
          break;
      if x==0:
          break;
      if x not in listx:
          listx.append(int(x))
      j+=1 
   i+=1 

# yが取り得る値
listy=[]
c=list[2]
d=list[3]

# yが水に溶け切れる最大値
f2=f*e/(100.0+e)

i=0
while True:
   if i*c>f2:
       break
   j=0
   while True:
      y=i*c+j*d
      if y > f:
          break;
      if y not in listy:
          listy.append(int(y))
      j+=1 
   i+=1 

# 全てのxとyの組み合わせについてfを超えないか、および溶け切れるかを調べる
lengthx=len(listx)
lengthy=len(listy)

xy_max=0
y_max=0
noudo_max=0
for i in range(lengthx):
    for j in range(lengthy):
        x=listx[i]
        y=listy[j]
        if x+y>f:
            continue
        noudo=float(y)/(x+y)
        if noudo>noudo_max:
            xy_max=x+y
            y_max=y
            noudo_max=noudo

message=str(xy_max)+" "+str(y_max)
print message

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = [int(n) for n in input().split(" ")]
dp = [-1 for n in range(f + 1)]
dp[0] = 0
for i in range(1530):
    next_dp = dp[:]
    for i,sugar in enumerate(dp):
        if sugar >= 0:
            if i + 100 * a <= f:
                next_dp[i + 100 * a] = sugar
            if i + 100 * b <= f:
                next_dp[i + 100 * b] = sugar
            if i + c <= f and ((i - sugar) * e) / 100 >= sugar + c:
                next_dp[i + c] = max(dp[i + c], sugar + c)
            if i + d <= f and ((i - sugar) * e) / 100 >= sugar + d:
                next_dp[i + d] = max(dp[i + d], sugar + d)
    dp = next_dp
answer = [0,0]
for i,d in enumerate(dp):
    if i != 0 and answer[1] < d / i:
        answer = [i,d / i]
print(answer[0],round(answer[0] * answer[1] ))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = [int(n) for n in input().split(" ")]
dp = [-1 for n in range(f + 1)]
dp[0] = 0
for i in range(1530):
    next_dp = dp[:]
    for i,sugar in enumerate(dp):
        if sugar >= 0:
            if i + 100 * a <= f:
                next_dp[i + 100 * a] = sugar
            if i + 100 * b <= f:
                next_dp[i + 100 * b] = sugar
            if i + c <= f and ((i - sugar) * e) / 100 >= sugar + c:
                next_dp[i + c] = max(dp[i + c], sugar + c)
            if i + d <= f and ((i - sugar) * e) / 100 >= sugar + d:
                next_dp[i + d] = max(dp[i + d], sugar + d)
    dp = next_dp
answer = [0,0]
for i,d in enumerate(dp):
    if i != 0 and answer[1] < d / i:
        answer = [i,d / i]
print(answer[0],int(answer[0] * answer[1] ))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = [int(n) for n in input().split(" ")]
dp = [-1 for n in range(f + 1)]
dp[0] = 0
for i in range(1530):
    next_dp = dp[:]
    for i,sugar in enumerate(dp):
        if sugar >= 0:
            if i + 100 * a <= f:
                next_dp[i + 100 * a] = sugar
            if i + 100 * b <= f:
                next_dp[i + 100 * b] = sugar
            if i + c <= f and ((i - sugar) * e) / 100 >= sugar + c:
                next_dp[i + c] = max(dp[i + c], sugar + c)
            if i + d <= f and ((i - sugar) * e) / 100 >= sugar + d:
                next_dp[i + d] = max(dp[i + d], sugar + d)
    dp = next_dp
answer = [0,0]
for i,d in enumerate(dp):
    if i != 0 and answer[1] <= d / i:
        answer = [i,d / i]
print(answer[0],int(answer[0] * answer[1] ))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = [int(n) for n in input().split(" ")]
dp = [-1 for n in range(f + 1)]
dp[0] = 0
for i in range(1530):
    next_dp = dp[:]
    for i,sugar in enumerate(dp):
        if sugar >= 0:
            if i + 100 * a <= f:
                next_dp[i + 100 * a] = sugar
            if i + 100 * b <= f:
                next_dp[i + 100 * b] = sugar
            if i + c <= f and ((i - sugar) * e) // 100 >= sugar + c:
                next_dp[i + c] = max(dp[i + c], sugar + c)
            if i + d <= f and ((i - sugar) * e) // 100 >= sugar + d:
                next_dp[i + d] = max(dp[i + d], sugar + d)
    dp = next_dp
answer = [0,0]
for i,d in enumerate(dp):
    if i != 0 and answer[1] <= d / i:
        answer = [i,d / i]
print(answer[0],int(answer[0] * answer[1] ))

Submission status: Wrong Answer

Solution code:
import numpy as np

def ceil(a):
    return int(np.ceil(a))

def sol2():
    A,B,C,D,E,F = map(int, input().split(' '))
    na, nb, nc, nd = ceil(F/A/100),ceil(F/B/100),ceil(E*F/C/100),ceil(E*F/D/100) 
    sug = np.arange(0,nc).reshape(1,1,nc,1)*C+np.arange(0,nd).reshape(1,1,1,nd)*D
    wat = np.arange(0,na).reshape(na,1,1,1)*A*100+np.arange(0,nb).reshape(1,nb,1,1)*B*100
    sug2=np.unique(sug[sug<=F*F/100])
    wat2=np.unique(wat[wat<=F])
    wat2[0]=1
    tot =  wat2.reshape(len(wat2),1) + sug2
    e2 = E/(100+E)
    dense = (sug2/tot)[tot<=F]
    
    if E==0:
        print(wat2[1],0)
        return
    
    maxi = np.argmax(dense[dense<=e2])
    stot = tot[tot<=F][dense<=e2]
    ssug = (sug2 + tot*0)[tot<=F][dense<=e2]
    
    if dense[maxi] ==0:
        print(wat2[1],0)
    else:
        print(int(stot[maxi]),int(ssug[maxi]))
sol2()

Submission status: Wrong Answer

Solution code:
import numpy as np

def ceil(a):
    return int(np.ceil(a))

def sol2():
    A,B,C,D,E,F = map(int, input().split(' '))
    na, nb, nc, nd = ceil(F/A/100),ceil(F/B/100),ceil(E*F/C/100),ceil(E*F/D/100) 
    sug = np.arange(0,nc).reshape(1,1,nc,1)*C+np.arange(0,nd).reshape(1,1,1,nd)*D
    wat = np.arange(0,na).reshape(na,1,1,1)*A*100+np.arange(0,nb).reshape(1,nb,1,1)*B*100
    sug2=np.unique(sug[sug<=F*F/100])
    wat2=np.unique(wat[wat<=F])
    tot =  wat2.reshape(len(wat2),1) + sug2
    tot[0,0]=1
    e2 = E/(100+E)
    dense = (sug2/tot)[tot<=F]
    maxi = np.argmax(dense[dense<=e2])
    stot = tot[tot<=F][dense<=e2]
    ssug = (sug2 + tot*0)[tot<=F][dense<=e2]
    print(int(stot[maxi]),int(ssug[maxi]))
sol2()

Submission status: Wrong Answer

Solution code:
import numpy as np

def ceil(a):
    return int(np.ceil(a))

def sol():
    A,B,C,D,E,F = map(int, input().split(' '))
    na, nb, nc, nd = ceil(F/A/100),ceil(F/B/100),ceil(E*F/C/100),ceil(E*F/D/100) 
    sug = np.arange(0,nc).reshape(1,1,nc,1)*C+np.arange(0,nd).reshape(1,1,1,nd)*D
    wat = np.arange(0,na).reshape(na,1,1,1)*A*100+np.arange(0,nb).reshape(1,nb,1,1)*B*100
    tot =  wat + sug
    tot[0,0,0,0]=1
    e2 = E/(100+E)*100
    dense = sug/tot*100
    maxi = np.argmax(dense[tot<=F][dense[tot<=F]<=e2])
    stot = tot[tot<=F][dense[tot<=F]<=e2]
    ssug = (sug + np.ndarray((na,nb,nc,nd))*0)[tot<=F][dense[tot<=F]<=e2]
    print(int(stot[maxi]),int(ssug[maxi]))
sol()

Submission status: Wrong Answer

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

w = [i+j for i in range(0,f+1,100*a) for j in range(0,f+1,100*b) if i+j <= f]
s = [i+j for i in range(0,f+1,c) for j in range(0,f+1,d) if i+j <= f]

W = f
S = 0
for ww in w :
    for ss in s :
        if ww+ss > f or ww == 0:
            continue
        elif ss/(ss+ww) > S/(W+S) and e >= 100*ss/ww:
            W = ww
            S = ss

print(W+S, S)

Submission status: Wrong Answer

Solution code:
lists = [int(i) for i in input().rstrip().split(" ")]
w_1 = 100 * lists[0]
w_2 = 100 * lists[1]
s_1 = lists[2]
s_2 = lists[3]
sol = lists[4] / (100 + lists[4])
limit = lists[5]

weight = 0
dens = 0
ans = (1,0)
w_group = set()

for i in range(limit//w_1 + 1):
    for j in range((limit-w_1*i)//w_2 + 1):
        w_group.add(w_1*i + w_2*j)
w_group.remove(0)

s_group = set()

for w_w in w_group:
    for i in range((limit-w_w)//s_1 + 1):
         for j in range((limit-w_w-s_1*i)//s_2 + 1):
             s_group.add(s_1*i + s_2*j)
    for s_s in s_group:
        weight = w_w + s_s
        dens = s_s / weight
        if sol >= dens > ans[1]/ans[0]:
            ans = (weight, s_s)
    s_group.clear()
print("{0} {1}".format(ans[0], ans[1]))

Submission status: Wrong Answer

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

max_density = 0
ans_water = 0
ans_sugar = 0
for na in range(F // (A * 100) + 1):
    for nb in range(F // (B * 100) + 1):
        water = (A * na + B * nb) * 100
        if water == 0 or water > F:
            break

        for nc in range(F // C + 1):
            for nd in range(F // D + 1):
                sugar = C * nc + D * nd
                if water + sugar > F:
                    break

                density = sugar / (water + sugar)
                if density > E / (100 + E):
                    break

                if density > max_density:
                    max_density = density
                    ans_water = water
                    ans_sugar = sugar

print(ans_water + ans_sugar, ans_sugar)