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())
ma = 0
ma_x,ma_y = 0,0

# 水の量
for x in range(100,f+1):
    if x%100 != 0:
        continue
    for i in range(x+1):
        j = x-i
        if i%(100*a) != 0 or j%(100*b) != 0:
            continue
        # 砂糖の量
        for y in range(f-x+1):
            for k in range(y+1):
                l = y-k
                if k%c != 0 or l%d !=0:
                    continue
                # 全て溶けるか
                if e*(x//100) < y:
                    continue
                noudo = 100*y/(x+y)
                if ma < noudo:
                    ma_x = x
                    ma_y = y
                    ma = noudo

print(ma_x+ma_y,ma_y)

Submission status: Wrong Answer

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

# 水の量
for x in range(100,f+1):
    for i in range(x):
        j = x-i
        if i%(100*a) != 0 or j%(100*b) != 0:
            continue
        # 砂糖の量
        for y in range(f-x+1):
            for k in range(y):
                l = y-k
                if k%c != 0 or l%d !=0:
                    continue
                # 全て溶けるか
                if e*(x//100) < y:
                    continue
                noudo = 100*y/(x+y)
                if ma < noudo:
                    ma_x = x
                    ma_y = y
                    ma = noudo

print(ma_x+ma_y,ma_y)

Submission status: Wrong Answer

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

# 水の量
for x in range(100,f+1):
    if x % 100 != 0:
        continue
    for i in range(x+1):
        j = x-i
        if i%(100*a) != 0 or j%(100*b) != 0:
            continue
        # 砂糖の量
        for y in range(f-x+1):
            for k in range(y+1):
                l = y-k
                if k%c != 0 or l%d !=0:
                    continue
                # 全て溶けるか
                if e*(x//100) < y:
                    continue
                noudo = 100*y/(x+y)
                if ma < noudo:
                    ma_x = x
                    ma_y = y
                    ma = noudo

print(ma_x+ma_y,ma_y)

Submission status: Wrong Answer

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

# 水の量
for x in range(1,f+1):
    if x % 100 != 0:
        continue
    for i in range(x+1):
        j = x-i
        if i%(100*a) != 0 or j%(100*b) != 0:
            continue
        # 砂糖の量
        for y in range(f-x+1):
            for k in range(y+1):
                l = y-k
                if k%c != 0 or l%d !=0:
                    continue
                # 全て溶けるか
                if e*(x//100) < y:
                    continue
                noudo = 100*y/(x+y)
                if ma < noudo:
                    ma_x = x
                    ma_y = y
                    ma = noudo

print(ma_x+ma_y,ma_y)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
w = []
s = []
for i in range(f // (100 * a) + 1):
  for j in range((f - 100 * a * i) // (100 * b) + 1):
    if 100 * a * i + 100 * b * j <= f:
      w.append(100 * a * i + 100 * b * j)
for i in range(f // c + 1):
  for j in range((f - c * i) // d + 1):
    if c * i + d * j <= f:
      s.append(c * i + d * j)
ans = (100 * a, 0)
l = 0
for i in w:
  for j in range(l, len(s)):
    if i + s[j] > f:
      break
    if s[j] > i // 100 * e:
      break
    if ans[1] * i < s[j] * ans[0]:
      ans = (i, s[j])
      l = j
print(ans[0] + ans[1], ans[1])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
ans = [pow(10, 9), 1]
a *= 100
b *= 100
for w1 in range(31):
    for w2 in range(31):
        water = w1 * a + w2 * b
        if water > f or water == 0:
            continue
        for s1 in range(min(water, 3000 - water)):
            for s2 in range(min(water, 3000 - water)):
                sugar = s1 * c + s2 * d
                if water + sugar > f or e / 100 < sugar / water:
                    break
                if ans[1] / ans[0] <= sugar / (water + sugar):
                    ans = [water + sugar, sugar]
print(ans[0], ans[1])

Submission status: Wrong Answer

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

water = set()
sugar = set()
for i in range(f // (100 * a) + 1):
    for j in range((f - 100 * a * i) // (100 * b) + 1):
        if 100 * a * i + 100 * b * j <= f:
            water.add(100 * a * i + 100 * b * j)

for i in range(f // c + 1):
    for j in range((f - c * i) // d + 1):
        if c * i + d * i <= f:
            sugar.add(c * i + d * j)

water = sorted(list(water))
sugar = sorted(list(sugar))

ans = (0, 0)
concentration = 0
for w in water:
    if w == 0:
        continue
    for s in sugar:
        if w + s <= f:
            if concentration < s / (w + s) <= e / (100 + e):
                concentration = s / (w + s)
                ans = (w + s, s)

print(*ans)

Submission status: Wrong Answer

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

water = []
sugar = []
for i in range(f // (100 * a) + 1):
    for j in range((f - 100 * a * i) // (100 * b) + 1):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)

for i in range(f // c + 1):
    for j in range((f - c * i) // d + 1):
        if c * i + d * i <= f:
            sugar.append(c * i + d * j)

water = list(set(water))
sugar = list(set(sugar))

ans = (0, 0)
concentration = 0
for w in water:
    if w == 0:
        continue
    for s in sugar:
        if 0 <= w + s <= f:
            if concentration < (100 * s) / (w + s) <= (100 * e) / (100 + e):
                concentration = (100 * s) / (w + s)
                ans = (w + s, s)

print(*ans)

Submission status: Wrong Answer

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

water = []
sugar = []
for i in range(f // (100 * a) + 1):
    for j in range((f - 100 * a * i) // (100 * b) + 1):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)

for i in range(f // c + 1):
    for j in range((f - c * i) // d + 1):
        if c * i + d * i <= f:
            sugar.append(c * i + d * j)

water = list(set(water))
sugar = list(set(sugar))

ans = (0, 0)
concentration = 0
for w in water:
    if w == 0:
        continue
    for s in sugar:
        if 0 < w + s <= f:
            if concentration < (100 * s) / (w + s) <= (100 * e) / (100 + e):
                concentration = (100 * s) / (w + s)
                ans = (w + s, s)

print(*ans)

Submission status: Wrong Answer

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

water = []
sugar = []
for i in range(f):
    for j in range(f):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)

for i in range(f):
    for j in range(f):
        for w in water:
            s = c * i + d * j
            if w + s != 0:
                if (100 * s) / (w + s) <= (100 * e) / (100 + e) and w + s <= f:
                    sugar.append(c * i + d * j)

water = list(set(water))
sugar = list(set(sugar))

ans = (0, 0)
concentration = 0
for w in water:
    if w == 0:
        continue
    for s in sugar:
        if 0 < w + s <= f:
            if concentration < (100 * s) / (w + s) <= (100 * e) / (100 + e):
                concentration = (100 * s) / (w + s)
                ans = (w + s, s)

print(*ans)

Submission status: Wrong Answer

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

water = []
sugar = []
for i in range(f):
    for j in range(f):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)
        if c * i + d * j <= f:
            sugar.append(c * i + d * j)

ans = (0, 0)
concentration = 0
for w in list(set(water)):
    if w == 0:
        continue
    for s in list(set(sugar)):
        if 0 < w + s <= f:
            if concentration < (100 * s) / (w + s) <= (100 * e) / (100 + e):
                concentration = (100 * s) / (w + s)
                ans = (w + s, s)

print(*ans)

Submission status: Wrong Answer

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

ans=[0,0]
concentration=0.0
for i in range(F//(100*B)+1):
    tmp_water=100*B*i
    for j in range((F-tmp_water)//(100*A)+1):
        tmp_water+=100*A*j
        max_suger=min((tmp_water//100)*E,F-tmp_water)
        for k in range((max_suger)//D+1):
            tmp_suger=D*k
            tmp_suger+=C*((max_suger-tmp_suger)//C)
            if tmp_water+tmp_suger==0:
                continue
            elif tmp_suger/(tmp_water+tmp_suger)>concentration:
                concentration=tmp_suger/(tmp_water+tmp_suger)
                ans[0]=tmp_water+tmp_suger
                ans[1]=tmp_suger

print(*ans)

Submission status: Wrong Answer

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

ans=[0,0]
concentration=0.0
for i in range(F//(100*B)+1):
    tmp_water=100*B*i
    for j in range((F-tmp_water)//(100*A)+1):
        tmp_water+=100*A*j
        max_suger=(tmp_water//100)*E
        for k in range((max_suger)//D+1):
            tmp_suger=D*k
            tmp_suger+=C*((max_suger-tmp_suger)//C)
            if tmp_water+tmp_suger==0:
                continue
            elif tmp_water+tmp_suger>F:
                break
            elif tmp_suger/(tmp_water+tmp_suger)>concentration:
                concentration=tmp_suger/(tmp_water+tmp_suger)
                ans[0]=tmp_water+tmp_suger
                ans[1]=tmp_suger

print(*ans)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
n=F//(100+E)
max_water=100*n

ans=[0,0]
concentration=0.0
for i in range(max_water//(100*B)+1):
    tmp_water=100*B*i
    for j in range((max_water-tmp_water)//(100*A)+1):
        tmp_water+=100*A*j
        max_suger=(tmp_water//100)*E
        for k in range((max_suger)//D+1):
            tmp_suger=D*k
            tmp_suger+=C*((max_suger-tmp_suger)//C)
            if tmp_water+tmp_suger==0:
                continue
            elif tmp_suger/(tmp_water+tmp_suger)>concentration:
                concentration=tmp_suger/(tmp_water+tmp_suger)
                ans[0]=tmp_water+tmp_suger
                ans[1]=tmp_suger

print(*ans)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
n=F//(100+E)
max_water=100*n

ans_water=0
for i in range(max_water//(100*B)+1):
    tmp=100*B*i
    tmp+=100*A*((max_water-tmp)//(100*A))
    ans_water=max(ans_water,tmp)

max_suger=(ans_water//100)*E
ans_suger=0
for i in range(max_suger//D+1):
    tmp=D*i
    tmp+=C*((max_suger-tmp)//C)
    ans_suger=max(ans_suger,tmp)

print(ans_water+ans_suger,ans_suger)

Submission status: Wrong Answer

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

water = []
sugar = []
for i in range(f):
    for j in range(f):
        if 100 * a * i + 100 * b * j <= f:
            water.append(100 * a * i + 100 * b * j)
        sugar.append(c * i + d * j)

ans = (0, 0)
max_c = 0
for w in list(set(water)):
    if w == 0:
        continue
    for s in list(set(sugar)):
        if w + s != 0 and w + s <= f:
            concentration = (100 * s) / (w + s)
            if max_c < concentration <= e:
                max_c = concentration
                ans = max(ans, (w + s, s))

print(*ans)

Submission status: Wrong Answer

Solution code:
# 無理だこれ
A, B, C, D, E, F = map(int, input().split())

w_list = []
s_list = []
d_list = []

for a in range(31):
    for b in range(31):
        for c in range(101):
            for d in range(101):
                w = (100 * A) * a + (100 * B) * b
                s = C * c + D * d
                if w == 0:
                    break
                if w + s > F:
                    break
                else:
                    if s <= w/100 * E:
                        d = 100 * s / (w + s)
                        w_list.append(w)
                        s_list.append(s)
                        d_list.append(d)

print(w_list[d_list.index(max(d_list))], s_list[d_list.index(max(d_list))])

Submission status: Wrong Answer

Solution code:
a_water, b_water, c_sugar, d_sugar, e_maxsugar, f_maxcup = map(int, input().split())

watercase = []
sugarcase = []
concent = -1
answeight = -1
anssuger = -1

a_case = f_maxcup // (100 * a_water)
b_case = f_maxcup // (100 * b_water)
c_case = int((f_maxcup / 100 * e_maxsugar) // (c_sugar))
d_case = int((f_maxcup / 100 * e_maxsugar) // (d_sugar))

for a in range(a_case + 1):
    for b in range(b_case + 1):
        if a * 100 * a_water + b * 100 * b_water <= f_maxcup:
            watercase.append(a * 100 * a_water + b * 100 * b_water)

for c in range(c_case + 1):
    for d in range(d_case + 1):
        if c * c_sugar + d * d_sugar <= f_maxcup:
            sugarcase.append(c * c_sugar + d * d_sugar)


for w in watercase:
    for s in sugarcase:
        if w + s != 0:
            if w + s <= f_maxcup and concent < (s / (w + s)) and s <= w / 100 * e_maxsugar:
                concent = s / (w + s)
                answeight = w + s
                anssuger = s
        else:
            if w + s <= f_maxcup and concent < 0 and s <= w / 100 * e_maxsugar:
                concent = 0
                answeight = w + s
                anssuger = s

print(answeight, anssuger)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(31):
    if a * 100 * A > F:
        continue
    for b in range(31):
        if 100 * A * a + 100 * B * b > F:
            continue
        for c in range(3000 // C + 1):
            if E * (a * A + b * B) < c * C:
                continue
            if 100 * A * a + 100 * B * b + c * C > F:
                continue
            print(a, b, c)
            d = (E * (a * A + b * B) - c * C) // D
            tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            if tmp_sugar_water == 0:
                continue
            if tmp_sugar_water > F:
                d = (F - (a * 100 * A + b * 100 * B + c * C)) // D
                tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            tmp_sugar = c * C + d * D
            tmp_concentration = tmp_sugar / tmp_sugar_water
            if max_concentration <= tmp_concentration:
                max_concentration = tmp_concentration
                max_sugar_water = tmp_sugar_water
                max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(31):
    if a * 100 * A > F:
        continue
    for b in range(31):
        if 100 * A * a + 100 * B * b > F:
            continue
        for c in range(3000 // C + 1):
            if E * (a * A + b * B) < c * C:
                continue
            if 100 * A * a + 100 * B * b + c * C > F:
                continue
            d = (E * (a * A + b * B) - c * C) // D
            tmp_sugar = c * C + d * D
            if tmp_sugar > E * (a * A + b * B):
                continue
            tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            if tmp_sugar_water > F or tmp_sugar_water == 0:
                continue
            tmp_concentration = tmp_sugar / tmp_sugar_water
            if max_concentration <= tmp_concentration:
                max_concentration = tmp_concentration
                max_sugar_water = tmp_sugar_water
                max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

Solution code:
a_water, b_water, c_sugar, d_sugar, e_maxsugar, f_maxcup = map(int, input().split())

watercase = []
sugarcase = []
concent = -1
answeight = -1
anssuger = -1

a_case = f_maxcup // (100 * a_water)
b_case = f_maxcup // (100 * b_water)
c_case = int((f_maxcup / 100 * e_maxsugar) // (c_sugar))
d_case = int((f_maxcup / 100 * e_maxsugar) // (d_sugar))


for a in range(a_case + 1):
    for b in range(b_case + 1):
        if a * 100 + b * 100 <= f_maxcup:
            watercase.append(a * 100 + b * 100)

for c in range(c_case + 1):
    for d in range(d_case + 1):
        if c * c_sugar + d * d_sugar <= f_maxcup:
            sugarcase.append(c * c_sugar + d * d_sugar)

watercase = set(watercase)
sugarcase = set(sugarcase)

for w in watercase:
    for s in sugarcase:
        if w + s != 0:
            if w + s <= f_maxcup and concent < (s / (w + s)) and s <= w / 100 * e_maxsugar:
                concent = s / (w + s)
                answeight = w + s
                anssuger = s
        else:
            if w + s <= f_maxcup and concent < 0 and s <= w / 100 * e_maxsugar:
                concent = 0
                answeight = w + s
                anssuger = s

print(answeight, anssuger)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(31):
    if a * 100 * A > F:
        continue
    for b in range(31):
        if 100 * A * a + 100 * B * b > F:
            continue
        for c in range(3000 // C + 1):
            if E * (a * A + b * B) < c * C:
                continue
            if 100 * A * a + 100 * B * b + c * C > F:
                continue
            d = (E * (a * A + b * B) - c * C) // D
            tmp_sugar = c * C + d * D
            if tmp_sugar > E * (a * A + b * B):
                continue
            tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            if tmp_sugar_water > F or tmp_sugar_water == 0:
                continue
            tmp_concentration = tmp_sugar / tmp_sugar_water
            if max_concentration < tmp_concentration:
                max_concentration = tmp_concentration
                max_sugar_water = tmp_sugar_water
                max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(31):
    if F < a * 100 * A:
        continue
    for b in range(31):
        if 100 * A * a + 100 * B * b > F:
            continue
        for c in range(F // C + 1):
            if E * (a * A + b * B) < c * C:
                continue
            d = (E * (a * A + b * B) - c * C) // D
            tmp_sugar = c * C + d * D
            if tmp_sugar > E * (a * A + b * B):
                continue
            tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            if tmp_sugar_water > F or tmp_sugar_water == 0:
                continue
            tmp_concentration = tmp_sugar / tmp_sugar_water
            if max_concentration < tmp_concentration:
                max_concentration = tmp_concentration
                max_sugar_water = tmp_sugar_water
                max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(31):
    if F < a * 100 * A:
        continue
    for b in range(31):
        if 100 * A * a + 100 * B * b > F:
            continue
        for c in range(E * (a * A + b * B) // C + 1):
            d = (E * (a * A + b * B) - c * C) // D
            tmp_sugar = c * C + d * D
            if tmp_sugar > E * (a * A + b * B):
                continue
            tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            if tmp_sugar_water > F or tmp_sugar_water == 0:
                continue
            tmp_concentration = tmp_sugar / tmp_sugar_water
            # print(tmp_sugar_water, tmp_sugar, tmp_concentration)
            if max_concentration < tmp_concentration:
                max_concentration = tmp_concentration
                max_sugar_water = tmp_sugar_water
                max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(F // (100 * A) + 1):
    for b in range((F - 100 * A * a) // (100 * B) + 1):
        for c in range(E * (a * A + b * B) // C + 1):
            d = (E * (a * A + b * B) - c * C) // D
            tmp_sugar = c * C + d * D
            if tmp_sugar > E * (a * A + b * B):
                continue
            tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
            if tmp_sugar_water > F or tmp_sugar_water == 0:
                continue
            tmp_concentration = tmp_sugar / tmp_sugar_water
            if max_concentration < tmp_concentration:
                max_concentration = tmp_concentration
                max_sugar_water = tmp_sugar_water
                max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

max_concentration = 0
max_sugar = 0
max_sugar_water = 0
for a in range(F // (100 * A) + 1):
    for b in range((F - 100 * A * a) // (100 * B) + 1):
        for c in range(E * (a * A + b * B) // C + 1):
            for d in range((E * (a * A + b * B) - c * C) // D + 1):
                tmp_sugar = c * C + d * D
                if tmp_sugar > E * (a * A + b * B):
                    continue
                tmp_sugar_water = a * 100 * A + b * 100 * B + c * C + d * D
                if tmp_sugar_water > F or tmp_sugar_water == 0:
                    continue
                tmp_concentration = tmp_sugar / tmp_sugar_water
                if max_concentration < tmp_concentration:
                    max_concentration = tmp_concentration
                    max_sugar_water = tmp_sugar_water
                    max_sugar = tmp_sugar
print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

Solution code:
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b, c, d, e, f = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    permax = 0
    wsol = 0
    wsug = 0
    for i in range(int(f / 100 / b) + 1):
        for j in range(int((f - 100 * b * i) / 100 / a) + 1):
            if i == 0 and j == 0:
                continue
            for k in range(int((f - (100*b*i + 100*a*j))/ d) + 1):
                for l in range(int((f - (100*b*i + 100*a*j + d*k))/ c) + 1):
                    if (d*k + c*l) / (b*i + a*j) <= e and (d*k + c*l) / (b*i + a*j) > permax:
                        permax = (d*k + c*l) / (b*i + a*j)
                        wsol = (d*k + c*l) + 100 * (b*i + a*j)
                        wsug = (d*k + c*l)
                        # imax = i
                        # jmax = j
                        # kmax = k
                        # lmax = l

    print(wsol, wsug)
#    print(imax, jmax, kmax, lmax)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b, c, d, e, f = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    permax = 0
    wsol = 0
    wsug = 0
    for i in range(int(f / 100 / b) + 1):
        for j in range(int((f - 100 * b * i) / 100 / a) + 1):
            if i == 0 and j == 0:
                continue
            for k in range(int((f - (100*b*i + 100*a*j))/ d) + 1):
                for l in range(int((f - (100*b*i + 100*a*j + d*k))/ c) + 1):
                    if (d*k + c*l) / (b*i + a*j) <= e and (d*k + c*l) / (b*i + a*j) > permax:
                        permax = (d*k + c*l) / (b*i + a*j)
                        wsol = (d*k + c*l) + 100 * (b*i + a*j)
                        wsug = (d*k + c*l)
                        # imax = i
                        # jmax = j
                        # kmax = k
                        # lmax = l

    print(wsol, wsug)
resolve()

Submission status: Wrong Answer

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    A,B,C,D,E,F = LI()

    w = set()
    for i in range(int(F/A/100)+1):
        for j in range(int(F/B/100)+1):
            if 0 < A*i+B*j <= int(F/100):
                w.add((A*i+B*j)*100)
    s = set()
    for i in range(int(F*E/(100+E)/C)+1):
        for j in range(int(F*E/(100+E)/D)+1):
            if 0 <= C*i+D*j <= int(F*E/(100+E)):
                s.add(C*i+D*j)

    max_E = -1.0
    ans_w = 0
    ans_s = 0
    for x in w:
        for y in s:
            if x + y <= F and E/x*100 >= y and max_E < y/(x+y) * 100:
                max_E = y/(x+y) * 100
                ans_w = x + y
                ans_s = y
    print(ans_w,ans_s)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    A,B,C,D,E,F = LI()

    w = set()
    for i in range(int(F/A/100)+1):
        for j in range(int(F/B/100)+1):
            if 0 < A*i+B*j <= int(F/100):
                w.add((A*i+B*j)*100)
    s = set()
    for i in range(int(F*E/(100+E)/C)+1):
        for j in range(int(F*E/(100+E)/D)+1):
            #if 0 <= C*i+D*j <= int(F*E/(100+E)):
                s.add(C*i+D*j)

    max_E = -1.0
    ans_w = 0
    ans_s = 0
    for x in w:
        for y in s:
            if x + y <= F and y/x*100 <= E and max_E < y/(x+y) * 100:
                max_E = y/(x+y) * 100
                ans_w = x + y
                ans_s = y
    print(ans_w,ans_s)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    A,B,C,D,E,F = LI()

    w = set()
    for i in range(int(F/A/100)+1):
        for j in range(int(F/B/100)+1):
            if 0 < A*i+B*j <= int(F/100):
                w.add((A*i+B*j)*100)
    s = set()
    for i in range(int(F*E/(100+E)/C)+1):
        for j in range(int(F*E/(100+E)/D)+1):
            if 0 <= C*i+D*j <= int(F*E/(100+E)):
                s.add(C*i+D*j)

    max_E = -1.0
    ans_w = 0
    ans_s = 0
    for x in w:
        for y in s:
            if x + y <= F and y/x*100 <= E and max_E < y/(x+y) * 100:
                max_E = y/(x+y) * 100
                ans_w = x + y
                ans_s = y
    print(ans_w,ans_s)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    A,B,C,D,E,F = LI()

    w = []
    for i in range(int(F/A/100)+1):
        for j in range(int(F/B/100)+1):
            if 0 < A*i+B*j <= int(F/100):
                w.append((A*i+B*j)*100)
    s = []
    for i in range(int(F*E/(100+E)/C)+1):
        for j in range(int(F*E/(100+E)/D)+1):
            if 0 <= C*i+D*j <= int(F*E/(100+E)):
                s.append(C*i+D*j)

    max_E = -1.0
    ans_w = 0
    ans_s = 0
    for x in w:
        for y in s:
            if x + y <= F and y/x*100 <= E and max_E < y/(x+y) * 100:
                max_E = y/(x+y) * 100
                ans_w = x + y
                ans_s = y
    print(ans_w,ans_s)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    A,B,C,D,E,F = LI()

    w = []
    for i in range(math.ceil(F/A/100)+1):
        for j in range(math.ceil(F/B/100)+1):
            if 0 < A*i+B*j <= int(F/100):
                w.append((A*i+B*j)*100)
    s = []
    for i in range(math.ceil(F*E/100/C)+1):
        for j in range(math.ceil(F*E/100/D)+1):
            if 0 <= C*i+D*j <= int(F*E/100):
                s.append(C*i+D*j)

    max_E = -1.0
    ans_w = 0
    ans_s = 0
    for x in w:
        for y in s:
            if x + y <= F and y/x*100 <= E and max_E < y/(x+y) * 100:
                max_E = y/(x+y) * 100
                ans_w = x + y
                ans_s = y
    print(ans_w,ans_s)


if __name__ == '__main__':
    main()