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())
Ans = [0,0,0]
def Con(water,sugar):
    return 100*(sugar)/(water+sugar)
def limit(water):
    return water*E//100
for NumA in range(1,F//(100*A)+2):
    for NumB in range(0,F//(100*B)+1):
        water = 100*(A*NumA+B*NumB)
        lim1 = limit(water)
        lim2 = F-water
        lim = min(lim1,lim2)
        for i in range(lim//D+1):
            sugar = D*i
            sugar += ((lim-sugar)//C)*C
            Con1 = Con(water,sugar)
            if Ans[0] < Con1:
                Ans = [Con1,water,sugar]
print(Ans[1]+Ans[2],Ans[2])

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
Ans = [0,0,0]
def Con(water,sugar):
    return 100*(sugar)/(water+sugar)
def limit(water):
    return water*E//100
for NumA in range(1,F//(100*A)+1):
    for NumB in range(0,F//(100*B)+1):
        water = 100*(A*NumA+B*NumB)
        lim1 = limit(water)
        lim2 = F-water
        lim = min(lim1,lim2)
        for i in range(lim//D):
            sugar = D*i
            sugar += ((lim-sugar)//C)*C
            Con1 = Con(water,sugar)
            if Ans[0] < Con1:
                Ans = [Con1,water,sugar]
print(Ans[1]+Ans[2],Ans[2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,mv=map(int,input().split())
e= e/(e+100)

ans=0 ;ans1=-1 ; ans2=-1
for i in range(31):
    if 100*i*a> mv: continue
    for j in range(31):
        if i+j==0:continue
        if 100*(i*a+j*b)> mv:continue
        for k in range(2801):
            if 100*(i*a+j*b)+k*c> mv:continue
            for l in range(2801):
                water=100*(a*i+b*j)
                sugar=k*c+l*d
                if water+sugar > mv:
                    break
                pp= sugar/(water+sugar)
                
                if e>= pp and ans<pp:
                    #print("water",water,"sugar",sugar,pp)
                    ans=pp
                    ans1= water+sugar
                    ans2= sugar
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,mv=map(int,input().split())
e= e/(e+100)

ans=0 ;ans1=-1 ; ans2=-1
for i in range(31):
    if 100*i*a> mv: continue
    for j in range(31):
        if i+j==0:continue
        if 100*(i*a+j*b)> mv:continue
        for k in range(1501):
            if 100*(i*a+j*b)+k*c> mv:continue
            for l in range(1501):
                water=100*(a*i+b*j)
                sugar=k*c+l*d
                if water+sugar > mv:
                    break
                pp= sugar/(water+sugar)
                
                if e>= pp and ans<pp:
                    #print("water",water,"sugar",sugar,pp)
                    ans=pp
                    ans1= water+sugar
                    ans2= sugar
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,mv=map(int,input().split())
ans=0 ;ans1=-1 ; ans2=-1
for i in range(31):
    for j in range(31):
        if i+j==0:continue
        for k in range(31):
            for l in range(31):
                water=100*(a*i+b*j)
                sugar=k*c+l*d
                if water+sugar > mv:
                    break
                pp= 100*sugar/(water+sugar)
                if e>= pp and ans<pp:
                    ans=pp
                    ans1= water+sugar
                    ans2= sugar
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
P = []
for i in range(31):
    for j in range(31):
        W=A*i+B*j
        if 100*W>F: break
        for k in range(3001):
            l = min(F-100*W-C*k,W*E-C*k)//D
            S = C*k+D*l
            if W+S<=0: continue
            P.append((100*S/(W*100+S),(W*100+S,S)))
P.sort(key=lambda x:x[0])
print(*P[-1][1])

Submission status: Wrong Answer

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

    waters = set()
    for i in range((30 + A - 1) // A + 1):
        for j in range((30 + B - 1) // B + 1):
            a = 100 * (i * A + j * B)
            if a > F or a == 0:
                continue
            waters.add(a)

    sugars = set()
    for k in range((3000 + C - 1) // C + 1):
        for l in range((3000 + D - 1) // D + 1):
            b = k * C + l * D
            if b > F or b == 0:
                continue
            sugars.add(b)

    max_density = -1
    ans = [-1, -1]
    for w in waters:
        for s in sugars:
            if w + s > F or w // 100 * E < s:
                continue
            density = 100 * s / (w + s)
            if density > max_density:
                ans = [(w + s), s]
                max_density = density
    return ans


print(*solve())

Submission status: Wrong Answer

Solution code:
from itertools import product
def main():
    a, b, c, d, e, f = list(map(int, input().split()))
    max_con = 0
    ans_w, ans_s = 0, 0
    W, S = [], []
    a *= 100
    b *= 100
    for i, j in product(range(f // a + 1), range(f // b + 1)):
        if (w := a * i + b * j) <= f:
            W.append(w)
    for i, j in product(range(f // c + 1), range(f // d + 1)):
        if (s := c * i + d * j) <= f:
            S.append(s)
    for w, s in product(W, S):
        if w == s == 0:
            continue
        if w * e >= 100 * s and (con := 100 * s / (w + s)) > max_con and w + s <= f:
            max_con = con
            ans_w, ans_s = w, s

    print(' '.join([str(ans_w + ans_s), str(ans_s)]))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


a, b, c, d, e, f = LI()
dp = [[0] * (30 + 1) for _ in range(f + 1)]
dp[0][0] = 1
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j]:
            if (j + a) * 100 + i <= f:
                dp[i][j + a] = 1
            if (j + b) * 100 + i <= f:
                dp[i][j + b] = 1
            if j * 100 + i + c <= f:
                dp[i + c][j] = 1
            if j * 100 + i + d <= f:
                dp[i + d][j] = 1

ans = 0
jj = 600
jk = 0
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j] and j and j * e >= i and ans < i / j:
            jk = i
            jj = j * 100 + jk

print(jj, jk)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


a, b, c, d, e, f = LI()
dp = [[0] * (30 + 1) for _ in range(f + 1)]
dp[0][0] = 1
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j]:
            if (j + a) * 100 + i <= f:
                dp[i][j + a] = 1
            if (j + b) * 100 + i <= f:
                dp[i][j + b] = 1
            if j * 100 + i + c <= f:
                dp[i + c][j] = 1
            if j * 100 + i + d <= f:
                dp[i + d][j] = 1

ans = 0
jj = 0
jk = 0
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j] and j and j * e >= i and ans < i / j:
            jk = i
            jj = j * 100 + jk

print(jj, jk)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


a, b, c, d, e, f = LI()
dp = [[0] * (30 + 1) for _ in range(f + 1)]
dp[0][0] = 1
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j]:
            if (j + a) * 100 + i <= f:
                dp[i][j + a] = 1
            if (j + b) * 100 + i <= f:
                dp[i][j + b] = 1
            if j * 100 + i + c <= f:
                dp[i + c][j] = 1
            if j * 100 + i + d <= f:
                dp[i + d][j] = 1

ans = 0
jk = 0
jj = 0
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j] and j and j * e >= i and ans < i / j:
            jk = i
            jj = j * 100 + jk

print(jj, jk)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


a, b, c, d, e, f = LI()
dp = [[0] * (30 + 1) for _ in range(f + 1)]
dp[0][0] = 1
for i in range(f + 1):
    for j in range(30 + 1):
        if dp[i][j]:
            if (j + a) * 100 + i <= f:
                dp[i][j + a] = 1
            if (j + b) * 100 + i <= f:
                dp[i][j + b] = 1
            if j * 100 + i + c <= f:
                dp[i + c][j] = 1
            if j * 100 + i + d <= f:
                dp[i + d][j] = 1


print(1, 3)

Submission status: Wrong Answer

Solution code:
from itertools import product

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

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt, ans = 0, (max(sets), 0)
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

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

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt, ans = 0, (0, max(setw))
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

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

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt, ans = 0, (0, 0)
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

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

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])

cnt, ans =0, (0, 0)
for water in setw:
    maxs = min(e * water // 100, f - water)
    limc = [c * i for i in range(maxs // c + 1)]
    limd = [d * i for i in range(maxs // d + 1)]
    sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= maxs])
    for sugar in sets:
        if cnt <= sugar // (sugar + water):
            cnt = sugar // (sugar + water)
            ans = (sugar + water, sugar)
        if sugar == e * water // 100:
            print(*ans)
            exit()
else:
    print(*ans)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()

concentration = 0
sgw = 0
sg = 0



x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and (i /100)*e  >= j:
           # print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
            concentration = temp
if sgw == 0:
    sgw = water[-1]
print(sgw,sg)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()

concentration = 0
sgw = 0
sg = 0



x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and (i /100)*e  >= j:
           # print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
            concentration = temp
        else:
            sgw = i
print(sgw,sg)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()

concentration = 0
sgw = 0
sg = 0



x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and (i /100)*e  >= j:
           # print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
            concentration = temp
print(sgw,sg)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()
sugar.remove(0)
concentration = 0
sgw = 0
sg = 0



x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and (i /100)*e  >= j:
           # print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
            concentration = temp
print(sgw,sg)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()
sugar.remove(0)
concentration = 0
sgw = 0
sg = 0

print(water)

x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and (i /100)*e  >= j:
           # print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
            concentration = temp
print(sgw,sg)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()
sugar.remove(0)
concentration = 0
sgw = 0
sg = 0


x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and (i /100)*e  >= j:
           # print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
            concentration = temp
print(sgw,sg)

Submission status: Wrong Answer

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

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

water = list(set(water))
water.sort()
water.remove(0)
sugar = list(set(sugar))
sugar.sort()

concentration = 0
sgw = 0
sg = 0

#print(water)
#print(sugar)

x = e/100

for i in water:
    for j in sugar:
        temp = (100 * j) / (i + j)
        if concentration < temp and i + j < f and j <= e:
            #print(i,j,concentration,temp,i*x)
            sgw = i + j
            sg = j
        concentration = temp
print(sgw,sg)

Submission status: Wrong Answer

Solution code:
#!python3

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


def solve(a, b, c, d):
    w = 100 * a * A + 100 * b * B + c * C + d * D
    s = c * C + d * D
    if w > F or s > (a * A + b * B) * E:
        return (0, 0)
    return (s / w, w, s)


def main():
    ans = (0, 100 * A, 0)
    for a in range(31):
        for b in range(31):
            if 100 * a + 100 * b > F or (a == 0 and b == 0):
                break
            for c in range(101):
                for d in range(E - c + 1):
                    x = solve(a, b, c, d)
                    ans = max(ans, x)

    print(ans[1], ans[2])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
# 100(Ax + By) + Cz + Dw <= F
# 100(Cz + Dw) / (100(Ax + By) + Cz + Dw) <= E
SD = {}
for i in range(101):
  for j in range(101):
    SD[i*C+j*D] = 1
Sup = F // (100 * A)
wans, sans, p = 0, 0, 0
for i in range(Sup+1):
  SUp = (F - 100 * A * i) // (100 * B)
  for j in range(SUp+1):
    W = 100 * (A * i + B * j)
    if i != 0 or j != 0:
      for S in SD:
        if W + S <= F and 100 * S <= W * E:
          if p < S / (S + W):
            wans, sans, p = W + S, S, S / (S + W)
print(wans, sans)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
L = []
for p in range(f//a+1):
    for q in range((f-a*p)//b+1):
        h = 100*(a*p+b*q)
        for r in range((f-h)//(c+1)):
            for s in range((f-h-c*r)//(d+1)):
                g = c*r+d*s
                if g+h !=0:
                    bool1 = (g/(g+h) <= e/(100+e))
                    if bool1 and g+h <= f:
                        if h !=0:
                            L.append((100*g/(g+h),g+h,g))
L.sort(reverse = True)  
#print(L)
print(L[0][1],L[0][2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
L = []
for p in range(3000//a+1):
    for q in range((3000-a*p)//b+1):
        h = 100*(a*p+b*q)
        for r in range((f-h)//(c+1)):
            for s in range((f-h-c*r)//(d+1)):
                g = c*r+d*s
                if g+h !=0:
                    bool1 = (g/(g+h) <= e/(100+e))
                    if bool1 and g+h <= f:
                        if h !=0:
                            L.append((100*g/(g+h),g+h,g))
L.sort(reverse = True)  
#print(L)
print(L[0][1],L[0][2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
L = []
for p in range(3000//a):
    for q in range((3000-a*p)//b):
        h = 100*(a*p+b*q)
        for r in range((f-h)//(c)):
            for s in range((f-h-c*r)//(d)):
                g = c*r+d*s
                if g+h !=0:
                    bool1 = (g/(g+h) <= e/(100+e))
                    if bool1 and g+h <= f:
                        if h !=0:
                            L.append((100*g/(g+h),g+h,g))
L.sort(reverse = True)  
#print(L)
print(L[0][1],L[0][2])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
L = []
for p in range(31):
    for q in range(31):
        h = 100*(a*p+b*q)
        for r in range((f-h)//(c)):
            for s in range((f-h)//(d)):
                g = c*r+d*s
                if g+h !=0:
                    bool1 = (g/(g+h) <= 100*e/(100+e))
                    if bool1 and g+h <= f:
                        if h !=0:
                            L.append((100*g/(g+h),g+h,g))
L.sort(reverse = True)  
#print(L)
print(L[0][1],L[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
ms = 0
mt = 100
for i in range(f//(100*a) + 1):
    for j in range((f-100*i*a)//(100*b) + 1):
        for k in range((f-i*a*100 - j*b*100)//(c)+1):
            for l in range((f-i*a*100 - j*b*100-k*c)//(d)+1):
#                print(i, j, k, i*a*100 + j*b*100+c*k+d*l)
                ss, tt = c*k+d*l, i*a*100 + j*b*100+c*k+d*l
                if ss*100 > e*(tt-ss):
                    continue
                if ss*mt > tt*ms:
                    ms, mt = ss, tt
print(mt, ms)
#        if i*a*100 + j*b*100 > f:
#            break

Submission status: Wrong Answer

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

noudo = 0
ans = (100, 0)
for a in range(31):
    for b in range(31):
        water = A * a + B * b
        if water*100 > F:
            break
        for c in range(3001):
            water = A * a + B * b
            if water == 0:
                break
            can_sugar = water * E
            if C * c > can_sugar:
                break
            rest = F - water * 100 - C*c
            if rest < 0:
                break
            rest_sugar = can_sugar - C * c
            sugar = (min(rest_sugar, rest) // D) * D
            tmp = (sugar + C*c) / (water + sugar + C*c)
            if noudo < tmp:
                noudo = tmp
                ans = (water*100 + C*c + sugar, c*C + sugar)

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

Submission status: Wrong Answer

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

noudo = 0
ans = (0, 0)
for a in range(31):
    for b in range(31):
        water = A * a + B * b
        if water*100 > F:
            break
        for c in range(3001):
            water = A * a + B * b
            if water == 0:
                break
            can_sugar = water * E
            if C * c > can_sugar:
                break
            rest = F - water * 100 - C*c
            if rest < 0:
                break
            rest_sugar = can_sugar - C * c
            sugar = (min(rest_sugar, rest) // D) * D
            tmp = (sugar + C*c) / (water + sugar + C*c)
            if noudo < tmp:
                noudo = tmp
                ans = (water*100 + C*c + sugar, c*C + sugar)

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

Submission status: Wrong Answer

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

noudo = 0
ans = (0, 0)
for a in range(31):
    for b in range(31):
        water = A * a + B * b
        if water*100 > F:
            break
        for c in range(3001):
            water = A * a + B * b
            if water == 0:
                break
            can_sugar = water * E
            if C * c > can_sugar:
                break
            rest = F - water * 100 - C*c
            if rest < 0:
                break
            rest_sugar = can_sugar - C * c
            sugar = min(rest_sugar, rest) // D * D
            tmp = (sugar + C*c) / (water + sugar + C*c)
            if noudo < tmp:
                noudo = tmp
                ans = (water*100 + C*c + sugar, c*C + sugar)

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

Submission status: Wrong Answer

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

noudo = 0
ans = (0, 0)
for a in range(31):
    for b in range(31):
        water = A * a + B * b
        if water*100 > F:
            break
        for c in range(3001):
            water = A * a + B * b
            if water == 0:
                break
            can_sugar = water * E
            if C * c > can_sugar:
                break
            rest = F - water * 100 - C*c
            if rest < 0:
                break
            rest_sugar = can_sugar - C * c
            sugar = min(rest_sugar, rest) // D * D
            tmp = (sugar + C*c) / water*100
            if noudo < tmp:
                noudo = tmp
                ans = (water*100 + C*c + sugar, c*C + sugar)

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

Submission status: Wrong Answer

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

noudo = 0
ans = (0, 0)
for a in range(31):
    for b in range(31):
        water = A * a + B * b
        if water*100 > F:
            break
        for c in range(3001):
            water = A * a + B * b
            if water == 0:
                break
            can_sugar = water * E
            if C * c > can_sugar:
                break
            rest = F - water * 100 - C*c
            rest_sugar = can_sugar - C * c
            sugar = min(rest_sugar, rest) // D * D
            tmp = (sugar + C*c) / water*100
            if noudo < tmp:
                noudo = tmp
                ans = (water*100 + C*c + sugar, c*C + sugar)

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

Submission status: Wrong Answer

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

noudo = 0
ans = (0, 0)
for a in range(31):
    for b in range(31):
        for c in range(3001):
            water = A * a + B * b
            if water == 0:
                break
            can_sugar = water * E
            if C * c > can_sugar:
                break
            rest = F - water * 100 - C*c
            rest_sugar = can_sugar - C * c
            sugar = min(rest_sugar, rest) // D * D
            tmp = (sugar + C*c) / water*100
            if noudo < tmp:
                noudo = tmp
                ans = (water*100 + C*c + sugar, c*C + sugar)

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