Problem:


Score : 300 points

Problem Statement

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

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

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

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

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

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

Snuke will make sugar water with the highest possible density.

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

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

Constraints

1 \leq A < B \leq 30

1 \leq C < D \leq 30

1 \leq E \leq 100

100A \leq F \leq 3 000

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

Inputs

Input is given from Standard Input in the following format:

A B C D E F

Outputs

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

Sample Input 1

1 2 10 20 15 200

Sample Output 1

110 10

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

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

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

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

Sample Input 2

1 2 1 2 100 1000

Sample Output 2

200 100

There are other acceptable outputs, such as:

400 200

However, the output below is not acceptable:

300 150

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

Sample Input 3

17 19 22 26 55 2802

Sample Output 3

2634 934



Sample input:
1 2 10 20 15 200


Sample output:
110 10

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b, c, d, e, f = list(map(int, input().rstrip('\n').split()))
    mn = 0
    x = y = 0
    for i in range(f // (a * 100) + 1):
        for j in range((f - 100 ** i) // (b * 100) + 1):
            for k in range((f - 100 * i - 100 * j) // c + 1):
                for l in range((f - 100 * i - 100 * j - k) // d + 1):
                    if 100 * i * a + 100 * j * b + c * k + d * l <= f:
                        if a * i + b * j != 0 and (c * k + d * l) / (a * i + b * j) <= e:
                            if mn < (c * k + d * l) / (100 * i * a + 100 * j * b + c * k + d * l):
                                if (100 * i * a + 100 * j * b + c * k + d * l) <= f:
                                    mn = (c * k + d * l) / (100 * i * a + 100 * j * b + c * k + d * l)
                                    x = 100 * i * a + 100 * j * b + c * k + d * l
                                    y = c * k + d * l
    print(x, y)



if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))+1):
        for j in range(ceil(F/(100*B))+1):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)+1):
        for j in range(ceil(F/C)+1):
            dy = C*i+D*j
            if(min(C,D) <= dy <= F):
                y.append(dy)

    x = sorted(list(set(x)))
    y = sorted(list(set(y)))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= 100*E/(100+E)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))):
        for j in range(ceil(F/(100*B))):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)):
        for j in range(ceil(F/C)):
            dy = C*i+D*j
            if(min(C,D) <= dy <= F):
                y.append(dy)

    x = sorted(list(set(x)))
    y = sorted(list(set(y)))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= 100*E/(100+E)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))):
        for j in range(ceil(F/(100*B))):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)):
        for j in range(ceil(F/C)):
            dy = C*i+D*j
            if(min(C,D) <= dy <= F):
                y.append(dy)

    x = list(set(x))
    y = list(set(y))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= 100*E*(i/100)/(i+j)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/(100*A))):
        for j in range(ceil(F/(100*B))):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)):
        for j in range(ceil(F/C)):
            dy = C*i+D*j
            if(min(C,D) <= dy <= F):
                y.append(dy)

    x = list(set(x))
    y = list(set(y))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= E*100/(i+j)):
                # print(i, j, ne)
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    
    x = []
    y = []  

    for i in range(ceil(F/100*A)):
        for j in range(ceil(F/100*B)):
            dx = 100*A*i+100*B*j
            if(min(100*A,100*B) <= dx <= F):
                x.append(dx)

    for i in range(ceil(F/C)):
        for j in range(ceil(F/C)):
            dy = C*i+D*j
            if(min(C,D) <= dy <= F):
                y.append(dy)

    x = list(set(x))
    y = list(set(y))
    
    w = x[0]
    s = y[0]

    for i in x:
        for j in y:
            de = 100*s/(w+s)
            ne = 100*j/(i+j)
            if(i+j <= F and de < ne <= E):
                w = i
                s = j

    print(w+s, s)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from math import ceil, floor

def solve(A: int, B: int, C: int, D: int, E: int, F: int):
    w = F
    s = 0
    for i in range(ceil(F/(100*A))):
        aw = 100*A*i
        for j in range(ceil(F/(100*B))):
            bw = 100*B*j
            for k in range(ceil((F-aw-bw)/C)):
                cs = C*k
                ds = min(D*floor((F-aw-bw-cs)/D), (aw*E+bw*E+cs*E)/max(1,100-E))
                if(aw+bw == 0 or cs+ds == 0): continue
                n = 100*s/(w+s)
                mn = 100*(cs+ds)/(aw+bw+cs+ds)
                if(mn <= E):
                    if(n < mn):
                        w = aw+bw
                        s = cs+ds
                        # print(i,j,k, mn)
    print(w, s)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    E = int(next(tokens))  # type: int
    F = int(next(tokens))  # type: int
    solve(A, B, C, D, E, F)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

W = []
S = []
for i in range((F//A)+1):
	j = 0
	while True:
		temp =  100*A*i + 100*B*j
		if temp <= F:
			W.append(temp)
		else:
			break

		j += 1


for i in range((F//C)+1):
	j = 0
	while True:
		temp =  C*i + D*j
		if temp <= F:
			S.append(temp)
		else:
			break

		j += 1

W.pop(0)
S.pop(0)

ans = 0
ans_whole = 0
ans_sugar = 0
for w in W:
	for s in S:
		if w+s <= F and s <= (w/100)*E:
			if ans <= (100*s)/(w+s):
				ans = (100*s)/(w+s)
				ans_whole = w+s
				ans_sugar = s

print(ans_whole, end= " ")
print(ans_sugar)

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

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

val = 0
ans1 = 100*A
ans2 = 0

for a in range(math.ceil(F/(100*A))):
    for b in range(math.ceil(F/(100*B))):
        for c in range(math.ceil((A*a+B*b)*E/C)):
            for d in range(math.ceil((A*a+B*b)*E/D)):
                if 100*(A*a+B*b)+C*c+D*d > F:
                    break
                if C*c+D*d > (A*a+B*b)*E:
                    break
                if A*a+B*b==0:
                    break
                if (C*c+D*d)/(A*a+B*b) > val:
                    val = (C*c+D*d)/(A*a+B*b)
                    ans1 = 100*(A*a+B*b)+C*c+D*d
                    ans2 = C*c+D*d

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

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

val = 0
ans1 = 100*A
ans2 = 0

for a in range(31):
    for b in range(31):
        for c in range(31):
            for d in range(31):
                if 100*(A*a+B*b)+C*c+D*d > F:
                    break
                if C*c+D*d > (A*a+B*b)*E:
                    break
                if A*a+B*b==0:
                    break
                if (C*c+D*d)/(A*a+B*b) > val:
                    val = (C*c+D*d)/(A*a+B*b)
                    ans1 = 100*(A*a+B*b)+C*c+D*d
                    ans2 = C*c+D*d

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 1
        sousa2 = 0
        ans = (0, 0, 0)
        while True:
            if sousa1 * 100 * A >= F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water >= F:
                    sousa2 = 0
                    break

                sugar_limit = water // 100 * E
                sousa3 = 0
                sousa4 = 0
                max_sugar = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar >= F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            max_sugar = max(max_sugar, sugar)
                        sousa4 += 1
                    sousa3 += 1
                concentration = 100 * max_sugar / (water + max_sugar)
                if ans[0] < concentration:
                    ans = [concentration, water, max_sugar]
                sousa2 += 1
            sousa1 += 1

        print('{} {}'.format(sum(ans[1:]), ans[2]))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 1
        sousa2 = 0
        ans = (0, 0, 0)
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water >= F:
                    sousa2 = 0
                    break

                sugar_limit = water // 100 * E
                sousa3 = 0
                sousa4 = 0
                max_sugar = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar >= F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            max_sugar = max(max_sugar, sugar)
                        sousa4 += 1
                    sousa3 += 1
                concentration = 100 * max_sugar / (water + max_sugar)
                if ans[0] < concentration:
                    ans = [concentration, water, max_sugar]
                sousa2 += 1
            sousa1 += 1

        print('{} {}'.format(sum(ans[1:]), ans[2]))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 0
        sousa2 = 0
        ans = (0, 0, 0)
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water == 0:
                    sousa2 += 1
                    continue
                if water > F:
                    sousa2 = 0
                    break
                sugar_limit = water // 100 * E
                sousa3 = 0
                sousa4 = 0
                max_sugar = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar > F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            max_sugar = max(max_sugar, sugar)
                        sousa4 += 1
                    sousa3 += 1
                concentration = 100 * max_sugar / (water + max_sugar)
                if ans[0] < concentration:
                    ans = [concentration, water, max_sugar]
                sousa2 += 1
            sousa1 += 1

        print('{} {}'.format(sum(ans[1:]), ans[2]))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 1
        sousa2 = 0
        ans = (0, 0, 0)
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water > F:
                    sousa2 = 0
                    break
                sugar_limit = water // 100 * E
                sousa3 = 0
                sousa4 = 0
                max_sugar = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar > F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            max_sugar = max(max_sugar, sugar)
                        sousa4 += 1
                    sousa3 += 1
                concentration = 100 * max_sugar / (water + max_sugar)
                if ans[0] < concentration:
                    ans = [concentration, water, max_sugar]
                sousa2 += 1
            sousa1 += 1

        print('{} {}'.format(sum(ans[1:]), ans[2]))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 1
        sousa2 = 0
        ans = (0, 0, 0)
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water > F:
                    sousa2 = 0
                    break
                sugar_limit = water // 100 * E
                sousa3 = 0
                sousa4 = 0
                max_sugar = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar > F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            max_sugar = max(max_sugar, sugar)
                        sousa4 += 1
                    sousa3 += 1
                concentration = 100 * max_sugar // (water + max_sugar)
                if ans[0] < concentration:
                    ans = [concentration, water, max_sugar]
                sousa2 += 1
            sousa1 += 1

        print('{} {}'.format(sum(ans[1:]), ans[2]))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 1
        sousa2 = 0
        ans = (0, 0, 0)
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water > F:
                    sousa2 = 0
                    break
                sugar_limit = water // 100 * E
                sousa3 = 1
                sousa4 = 0
                max_sugar = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar > F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            max_sugar = max(max_sugar, sugar)
                        sousa4 += 1
                    sousa3 += 1
                concentration = 100 * max_sugar // (water + max_sugar)
                if ans[0] < concentration:
                    ans = [concentration, water, max_sugar]
                sousa2 += 1
            sousa1 += 1

        print('{} {}'.format(sum(ans[1:]), ans[2]))


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 1
        sousa2 = 0
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                if water > F:
                    sousa2 = 0
                    break
                sugar_limit = water // 100 * E
                sousa3 = 0
                sousa4 = 0
                while True:
                    if sousa3 * C > sugar_limit:
                        break
                    while True:
                        sugar = sousa3 * C + sousa4 * D
                        if water + sugar > F or sugar > sugar_limit:
                            sousa4 = 0
                            break
                        else:
                            print('{} {}'.format(water + sugar, sugar))
                            exit()
                        sousa4 += 1
                    sousa3 += 1
                sousa2 += 1
            sousa1 += 1


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, D, E, F = map(int, input().split())

        sousa1 = 0
        sousa2 = 0
        max_water = 0
        sugar_limit = 0
        while True:
            if sousa1 * 100 * A > F:
                break
            while True:
                water = sousa1 * 100 * A + sousa2 * 100 * B
                sugar = water // 100 * E
                sugar_water = water + sugar
                if sugar_water > F:
                    sousa2 = 0
                    break
                else:
                    max_water = max(max_water, water)
                    sugar_limit = max(sugar_limit, sugar)
                sousa2 += 1
            sousa1 += 1

        sousa3 = 0
        sousa4 = 0
        max_sugar = 0
        while True:
            if sousa3 * C > sugar_limit:
                break
            while True:
                sugar = sousa3 * C + sousa4 * D
                if sugar > sugar_limit:
                    sousa4 = 0
                    break
                else:
                    max_sugar = max(max_sugar, sugar)
                sousa4 += 1
            sousa3 += 1

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


# Run main
if __name__ == '__main__':
    AtCoder().main()

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
xset = set()
yset = set()
for i in range(31):
  for j in range(16):
    if (a*i+b*j)*100 <= f:
      xset.add((a*i+b*j)*100)
xset.remove(0)
for i in range(f//c+1):
  for j in range(f//d+1):
    if c*i+c*j<=f:
      yset.add(c*i+d*j)
ll = []
maxconc = 0
maxsolution = 0
maxsolute = 0
for i in xset:
  for j in yset:
    if i+j<= f and i >= (100*j)/e and (100*j)/(i+j)>maxconc:
      maxconc = (100*j)/(i+j)
      maxsolution = i+j
      maxsolute = j
print(str(maxsolution)+' '+str(maxsolute))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
A,B,C,D,E,F=map(int,input().split())

A=A*100
B=B*100

ans=[]
water=set()

for i in range(F//(A)+1):
    for j in range((F-A*i)//B+1):
        water.add(A*i+B*j)
water.remove(0)

ans=-1
ans_all=-1
ans_sol=-1

for item in water:
    for i in range((F-item)//(C)+1):
        if C*i/item*100>E:
            break
        j=min((F-item-C*i)//D,(item*E/100-C*i)//D)#ここにEの条件をいれればいいのでは
        if (C*i+D*j)/(item+C*i+D*j)>ans:
            ans_sol=C*i+D*j
            ans_all=item+ans_sol
            ans=ans_sol/ans_all
    
print(ans_all,ans_sol)

Submission status: Wrong Answer

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

result = [0, 0]
noude = 0
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                water = a * 100 * i + b * 100 * j
                sugar = c * k + d * l
                if water == 0 or water + sugar > f:
                    break
                if (water / 100) * e >= sugar and noude < (100 * sugar) / (water + sugar):
                    noude = (100 * sugar) / (water + sugar)
                    result = [water + sugar, sugar]

print(result[0], result[1])

Submission status: Wrong Answer

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

result = [0, 0]
noude = 0
for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                water = a * 100 * i + b * 100 * j
                sugar = c * k + d * l
                if water == 0 or water + sugar > f:
                    break
                if (water / 100) * e >= sugar and noude < (100 * sugar) / (water + sugar):
                    noude = (100 * sugar) / (water + sugar)
                    result = [water + sugar, sugar]

print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    A, B, C, D, E, F = map(int, input().split())
    
    mx = 0
    sugar_weight = 0
    water_weight = 0
    for a in range(F // (100 * A) + 1):
        A_w = 100 * A * a
        for b in range((F - A_w) // (100 * B) + 1):
            B_w = 100 * B * b
            for c in range((F - (A_w + B_w)) // C + 1):
                C_w = C * c
                for d in range((F - (A_w + B_w + C_w)) // D + 1):
                    D_w = D * d
                    if a == 0 and b == 0:
                        pass
                    elif C * c + D * d <= E * (A * a + B * b):
                        if mx < (100 * (C_w + D_w)) / (A_w + B_w + C_w + D_w):
                            mx = (100 * (C_w + D_w)) / (A_w + B_w + C_w + D_w)
                            sugar_weight = C_w + D_w
                            water_weight = A_w + B_w + C_w + D_w
                
        rest_weight = F

    print(water_weight, sugar_weight)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    A, B, C, D, E, F = map(int, input().split())
    
    mx = 0
    rest_weight = F
    sugar_weight = 0
    water_weight = 0
    for a in range(rest_weight // (100 * A) + 1):
        A_w = 100 * A * a
        rest_weight -= A_w
        for b in range(rest_weight // (100 * B) + 1):
            B_w = 100 * B * b
            rest_weight -= B_w
            for c in range(rest_weight // C + 1):
                C_w = C * c
                rest_weight -= C_w
                for d in range(rest_weight // D + 1):
                    D_w = D * d
                    #print(a, b, c, d)
                    if a == 0 and b == 0:
                        pass
                    elif C * c + D * d <= E * (A * a + B * b):
                        if mx < (100 * (C_w + D_w)) / (A_w + B_w + C_w + D_w):
                            mx = (100 * (C_w + D_w)) / (A_w + B_w + C_w + D_w)
                            sugar_weight = C_w + D_w
                            water_weight = A_w + B_w + C_w + D_w
        rest_weight = F

    print(water_weight, sugar_weight)