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 main():
    a,b,c,d,e,f = map(int,input().split())
    water= ( ( (100*f)/(100+e) ) //100 )*100
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for i in range(int(water//b)+1):
        w=int(b*i+((water-b*i)//a)*a)
        sugar=(w*e)/100
        for i in range(int(sugar//d)+1):
            s=int(d*i+((sugar-d*i)//c)*c)
            if w!=0 and den<(s)/(w+s):
                den=(s)/(w+s)
                ans[0]=w+s
                ans[1]=s

    print(ans[0],ans[1])
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    water_max= ( ( (100*f)/(100+e) ) //100 )*100
    w=s=0
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for water in range(int(water_max//100)):
        water+=1
        water*=100
        for i in range(int(water//b)+1):
            x=b*i+((water-b*i)//a)*a
            w=max(w,int(x))
        sugar=(w*e)/100
        for i in range(int(sugar//d)+1):
            x=d*i+((sugar-d*i)//c)*c
            s=max(s,int(x))
        if w!=0 and den<(s)/(w+s):
            den=(s)/(w+s)
            ans[0]=w+s
            ans[1]=s

    print(ans[0],ans[1])
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    water=(100*f)/(100+e)
    w=s=0
    a*=100
    b*=100
    for i in range(int(water//b)+1):
        x=b*i+((water-b*i)//a)*a
        w=max(w,int(x))
    sugar=(w*e)/100
    for i in range(int(sugar//d)+1):
        x=d*i+((sugar-d*i)//c)*c
        s=max(s,int(x))
    print(w+s,s)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    A, B, C, D, E, F = map(int, input().split())
    waters = set()
    sugars = set()
    for a in range(0, F, 100 * A):
        for b in range(0, F, 100 * B):
            if a + b <= F:
                waters.add(a + b)
            else:
                break
    for c in range((F//C)+1):
        for d in range((F//D)+1):
            if c * C + d * D <= F:
                sugars.add(c * C + d * D)
            else:
                break
    waters = sorted(list(waters))[1:]
    sugars = sorted(list(sugars))[1:]
    # print(sugars)
    ans = 0
    ans_w = 0
    ans_s = 0
    for w in waters:
        for s in sugars:
            if w + s <= F:
                if s <= (w//100) * E:
                    tmp = (100 * s)/(w + s)
                    # if w == 1700:
                        # print(w, s, (100 * s)/(w + s))
                    if tmp > ans:
                        ans = tmp
                        ans_w = w
                        ans_s = s
            else:
                break
    print(ans_w + ans_s, ans_s)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    A, B, C, D, E, F = map(int, input().split())
    waters = set()
    sugars = set()
    for a in range((F//100) + 1):
        for b in range((F//100) + 1):
            tmp = 100 * a + 100 * b
            if tmp <= F:
                waters.add(tmp)
            else:
                break
    for c in range((F//C)+1):
        for d in range((F//D)+1):
            if c * C + d * D <= F:
                sugars.add(c * C + d * D)
            else:
                break
    waters = sorted(list(waters))[1:]
    sugars = sorted(list(sugars))[1:]
    # print(waters)
    # print(sugars)
    ans = 0
    ans_w = 0
    ans_s = 0
    for w in waters:
        for s in sugars:
            if w + s <= F:
                if s <= (w//100) * E:
                    tmp = (100 * s)/(w + s)
                    if w == 1700:
                        print(w, s, (100 * s)/(w + s))
                    if tmp > ans:
                        ans = tmp
                        ans_w = w
                        ans_s = s
            else:
                break
    print(ans_w + ans_s, ans_s)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

x, y, maxe = 0, 0, 0.0

for a in range(F//(A*100)+1):
    for b in range((F-100*A*a)//(B*100)+1):
        for c in range((F-100*(A*a+B*b))//C+1):
            for d in range((F-100*(A*a+B*b)-C*c)//D+1):
                if A*a+B*b == 0:
                    continue
                e = (C*c+D*d) / (A*a+B*b)
                if e <= E and maxe < e:
                    maxe = e
                    y = C*c+D*d
                    x = 100*(A*a+B*b) + y

print(x, y)

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()))
    abcd = 0
    cd = 0
    md = 0
    for ai in range(0, f + 1, a * 100):
        for bi in range(0, f + 1, b * 100):
            for ci in range(0, f + 1, c):
                for di in range(0, f + 1, d):
                    if 0 < ai + bi + ci + di <= f:
                        if ai + bi != 0:
                            if md < (ci + di) / (ai + bi + ci + di) <= e / (100 + e):
                                md = (ci + di) / (ai + bi + ci + di)
                                abcd = ai + bi + ci + di
                                cd = ci + di
                    else:
                        break
    print(abcd, cd)


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:

from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

import sys
def input():
	return sys.stdin.readline().strip()

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

water = [0]*(F//100 + 1)
water[0] = 1
water_list = [0]
for i in range(1, len(water)):
	if A <= i and water[i - A] == 1:
		water[i] = 1
		water_list.append(i*100)
	elif B <= i and water[i - B] == 1:
		water[i] = 1
		water_list.append(i * 100)

suger = [0]*(E*water_list[-1]//100 + 1)
suger[0] = 1
max_n = 0
ws = [A*100, 0]
for i in range(1, len(suger)):
	if C <= i and suger[i - C] == 1:
		suger[i] = 1
	elif D <= i and suger[i - D] == 1:
		suger[i] = 1
	if suger[i] == 1:
		max_s = i*100/E
		loc = bisect.bisect_left(water_list, max_s)
		if loc <= len(water_list) and  water_list[loc] + i <= F:
			max_n = max(max_n, 100*i/(water_list[loc] + i))
			ws = [water_list[loc], i]
		#print(water_list[loc], i, max_s, max_n)
print(ws[0] + ws[1], ws[1])

Submission status: Wrong Answer

Solution code:

from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq

import sys
def input():
	return sys.stdin.readline().strip()

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

water = [0]*(F//100 + 1)
water[0] = 1
water_list = [0]
for i in range(1, len(water)):
	if A <= i and water[i - A] == 1:
		water[i] = 1
		water_list.append(i*100)
	elif B <= i and water[i - B] == 1:
		water[i] = 1
		water_list.append(i * 100)

suger = [0]*(E*water_list[-1]//100 + 1)
suger[0] = 1
max_n = 0
ws = [0, 0]
for i in range(1, len(suger)):
	if C <= i and suger[i - C] == 1:
		suger[i] = 1
	elif D <= i and suger[i - D] == 1:
		suger[i] = 1
	if suger[i] == 1:
		max_s = i*100/E
		loc = bisect.bisect_left(water_list, max_s)
		if loc <= len(water_list) and  water_list[loc] + i <= F:
			max_n = max(max_n, 100*i/(water_list[loc] + i))
			ws = [water_list[loc], i]
		#print(water_list[loc], i, max_s, max_n)
print(ws[0] + ws[1], ws[1])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
a_list = set([])
b_list = set([])
for i in range((f // a) + 1):
    for j in range((f // b) + 1):
        if 0 < ((a*i) + (b*j)) * 100 <= f:
            a_list.add(((a*i)+(b*j))*100)
for i in range((f // c) + 1):
    for j in range((f // d) + 1):
        if ((c*i) + (d*j)) <= f:
            b_list.add((c*i)+(d*j))
ans = 0
ans_1 = 0
ans_2 = 0
for aa in a_list:
    for bb in b_list:
        if (aa + bb <= f) & ((bb / (aa + bb)) * 100 <= e):
            if ans < (bb / (aa + bb)) * 100:
                ans = (bb / aa) * 100
                ans_1 = aa + bb
                ans_2 = bb
print(str(ans_1) + " " + str(ans_2))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
a_list = set([])
b_list = set([])
for i in range((f // a) + 1):
    for j in range((f // b) + 1):
        if 0 < ((a*i) + (b*j)) * 100 <= f:
            a_list.add(((a*i)+(b*j))*100)
for i in range((f // c) + 1):
    for j in range((f // d) + 1):
        if ((c*i) + (d*j)) <= f:
            b_list.add((c*i)+(d*j))
ans = 0
ans_1 = 0
ans_2 = 0
for aa in a_list:
    for bb in b_list:
        if (aa + bb <= f) & ((bb / aa) * 100 <= e):
            if ans <= (bb / aa) * 100:
                ans = (bb / aa) * 100
                ans_1 = aa + bb
                ans_2 = bb
print(str(ans_1) + " " + str(ans_2))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
a_list = set([])
b_list = set([])
for i in range(f // a):
    for j in range(f // b):
        if 0 < ((a*i) + (b*j)) * 100 <= f:
            a_list.add(((a*i)+(b*j))*100)
for i in range(f // c):
    for j in range(f // d):
        if ((c*i) + (d*j)) <= f:
            b_list.add((c*i)+(d*j))
ans = 0
ans_1 = 0
ans_2 = 0
for aa in a_list:
    for bb in b_list:
        if (aa + bb <= f) & ((bb / aa) * 100 <= e):
            if ans <= (bb / aa) * 100:
                ans = (bb / aa) * 100
                ans_1 = aa + bb
                ans_2 = bb
print(str(ans_1) + " " + str(ans_2))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
#ARC083C
import sys
import math

#n=int(input())

tmp = input().split()
a,b,c,d,e,f = list(map(lambda a: int(a), tmp))

#print("{} {} {} {} {} {}".format(a,b,c,d,e,f))

ansrate=0
ans=0
anstotal=0
amax=(f//100)//a
bmax=(f//100)//b
for i in range(0,amax+1):
	for j in range(0,bmax+1):
		watersum=(i*a+j*b)#1/100
		if(watersum*100<=f):
			sugarmax=watersum*e
			#print("i:{} j:{} watersum:{} sugarmax:{}".format(i,j,watersum,sugarmax))
			cmax=(sugarmax)//c
			dmax=(sugarmax)//d
			for m in range(0,cmax+1):
				for n in range(0,dmax+1):
					sugarsum=m*c+n*d
					if((sugarsum<=sugarmax)and(sugarsum+watersum*100<=f)and(sugarsum+watersum*100!=0)):
						sugarsumrate=sugarsum/(sugarsum+watersum*100)
						if(ansrate<sugarsumrate):
							#print("{} {} {} {} {} {} sug:{} wat:{} rate:{}".format(a,b,c,d,e,f,sugarsum,watersum,sugarsumrate))
							ansrate=sugarsumrate
							ans=sugarsum
							anstotal=sugarsum+watersum*100

ret=str(anstotal)+" "+str(ans)
print(ret)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
#ARC083C
import sys
import math

#n=int(input())

tmp = input().split()
a,b,c,d,e,f = list(map(lambda a: int(a), tmp))

#print("{} {} {} {} {} {}".format(a,b,c,d,e,f))

ansrate=0
ans=0
anstotal=0
amax=(f//100)//a
bmax=(f//100)//b
for i in range(0,amax+1):
	for j in range(0,bmax+1):
		watersum=(i*a+j*b)#1/100
		if(watersum*100<=f):
			sum=(i*a+j*b)*100
			sugarmax=watersum*e
			#print("i:{} j:{} watersum:{} sugarmax:{}".format(i,j,watersum,sugarmax))
			cmax=(sugarmax)//c
			dmax=(sugarmax)//d
			for m in range(0,cmax+1):
				for n in range(0,dmax+1):
					sugarsum=m*c+n*d
					if((sugarsum<=sugarmax)and(sugarsum+watersum*100<=f)and(sugarsum+watersum*100!=0)):
						sugarsumrate=sugarsum/(sugarsum+watersum*100)
						if(ansrate<sugarsumrate):
							#print("{} {} {} {} {} {} sug:{} wat:{} rate:{}".format(a,b,c,d,e,f,sugarsum,watersum,sugarsumrate))
							ansrate=sugarsumrate
							ans=sugarsum
							anstotal=sugarsum+watersum*100

ret=str(anstotal)+" "+str(ans)
print(ret)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
#ARC083C
import sys
import math

#n=int(input())

tmp = input().split()
a,b,c,d,e,f = list(map(lambda a: int(a), tmp))

#print("{} {} {} {} {} {}".format(a,b,c,d,e,f))

ansrate=0
ans=0
anstotal=0
amax=(f//100)//a
bmax=(f//100)//b
for i in range(0,amax+1):
	for j in range(0,bmax+1):
		watersum=(i*a+j*b)#1/100
		if(watersum*100<=f):
			sum=(i*a+j*b)*100
			sugarmax=watersum*e
			#print("i:{} j:{} watersum:{} sugarmax:{}".format(i,j,watersum,sugarmax))
			#watersum*=100
			cmax=(sugarmax)//c
			dmax=(sugarmax)//d
			for m in range(0,cmax):
				for n in range(0,dmax):
					sugarsum=m*c+n*d
					if((sugarsum<=sugarmax)and(sugarsum+watersum*100<=f)):
						sugarsumrate=sugarsum/(sugarsum+watersum*100)
						if(ansrate<sugarsumrate):
							#print("{} {} {} {} {} {} sug:{} wat:{}".format(a,b,c,d,e,f,sugarsum,watersum))
							ansrate=sugarsumrate
							ans=sugarsum
							anstotal=sugarsum+watersum*100

ret=str(anstotal)+" "+str(ans)
print(ret)

Submission status: Wrong Answer

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

mc, mw, ms = 0, 0, 0
for a in range(F // (A * 100) + 1):
    for b in range((F - a * A * 100) // (B * 100) + 1):
        for c in range((F - (a * A + b * B) * 100) // C + 1):
            for d in range((F - (a * A + b * B) * 100) // D + 1):
                w, s = (a * A + b * B) * 100, c * C + d * D
                if w > 0 and w + s <= F and w * E >= s * 100 and mc < s / (w + s):
                    mc, mw, ms = s / (w + s), w, s
print(mw + ms, ms)

Submission status: Wrong Answer

Solution code:
def satou(a,b):
    return 100 * b / (a+b)

a,b,c,d,e,f = map(int,input().split())
water = [-1 for j in range(f+2)]
sugar = [-1 for i in range(f+2)]
water[0] = 0
sugar[0] = 0

for i in range(f+1):
    if water[i] > -1:
        if i+100*a <= f :
            water[i+100*a] = i+100*a 
        if i+100*b <= f :
            water[i+100*b] = i+100*b

for i in range(f+1):
    if sugar[i] > -1:
        if i+c <= f :
            sugar[i+c] = i+c
        if i+d <= f :
            sugar[i+d] = i+d

w = list(set(water))
w.remove(-1)
w.remove(0)
s = list(set(sugar))
s.remove(-1)
s.remove(0)
mx = 0
ws = [0,0]
for i in w:
    for j in s:
        x = ((f-i) // j) * j
        y = ((e*i/100)//j) * j
        t = satou(i, min(x,y))
        if mx < t:
            mx = t
            ws = [i, min(x,y)]

print(int(sum(ws)), int(ws[1]))

Submission status: Wrong Answer

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

ans_w = 0
ans_s = 0
max_ans = 0.0
for a in range(31):
    for b in range(31):
        w = 100 * (A * a + B * b)
        if w > F:
            break
        for c in range((w // 100 * E) // C + 1):
            for d in range(((w // 100 * E) - c) // D + 1):
                s = C * c + D * d
                if s > (w // 100 * E) or (w + s) > F:
                    break
                if w + s != 0:
                    n = (100 * s) / (w + s)
                    if n > max_ans:
                        max_ans = n
                        ans_w = w
                        ans_s = s

if ans_w and ans_s == 0:
    print(100 * A, 0)
else:
    print(ans_w + ans_s, ans_s)

Submission status: Wrong Answer

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

ans_w = 0
ans_s = 0
max_ans = 0.0
for a in range(31):
    for b in range(31):
        w = 100 * (A * a + B * b)
        if w > F:
            break
        for c in range((w // 100 * E) // C + 1):
            for d in range((w // 100 * E) // D + 1):
                s = C * c + D * d
                if s > (w // 100 * E) or (w + s) > F:
                    break
                if w + s != 0:
                    n = (100 * s) / (w + s)
                    if n > max_ans:
                        max_ans = n
                        ans_w = w
                        ans_s = s

if ans_w and ans_s == 0:
    print(100 * A, 0)
else:
    print(ans_w + ans_s, ans_s)

Submission status: Wrong Answer

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

ans_w = 0
ans_s = 0
max_ans = 0.0
for a in range(31):
    for b in range(31):
        w = 100 * (A * a + B * b)
        if w > F:
            break
        for c in range((w // 100 * E) // C + 1):
            for d in range((w // 100 * E) // D + 1):
                s = C * c + D * d
                if s > (w // 100 * E) or (w + s) > F:
                    break
                if w + s == 0:
                    break
                n = (100 * s) / (w + s)
                if n > max_ans:
                    max_ans = n
                    ans_w = w
                    ans_s = s
print(ans_w+ ans_s, ans_s)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range(((a + b) * E) // C + 1):
            for d in range(((a + b) * E) // D + 1):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

if ans_A == 0:
    print(100 * A, 0)
else:
    print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range((a + b) * E + 1):
            for d in range((a + b) * E - c + 1):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

if ans_A == 0:
    print(100 * A, 0)
else:
    print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range((a + b) * E + 1):
            for d in range((a + b) * E + 1):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

if ans_A == 0:
    print(100 * A, 0)
else:
    print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range((a + b) * E):
            for d in range((a + b) * E):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

if ans_A == 0:
    print(100 * A, 0)
else:
    print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range((a + b) * E):
            for d in range((a + b) * E):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range(101):
            for d in range(101):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        for c in range(30 * E // C):
            for d in range(30 * E // D):
                x = 100 * (a * A + b * B)
                y = c * C + d * D
                if x + y <= F and y <= x * E // 100 and x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

print(ans_A, ans_B)

Submission status: Wrong Answer

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

tmp = 0
ans_A = 0
ans_B = 0
for a in range(A):
    for b in range(B):
        for c in range(C):
            for d in range(D):
                x = 100 * (a + b)
                y = c + d
                if x + y <= F and y <= x * E // 100 and x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x
                        ans_B = y
                        tmp = y / (x + y)

print(ans_A, ans_B)

Submission status: Wrong Answer

Solution code:
def solve(C, D, lim):
    ans = 0
    for i in range(3000):
        if C*i > lim:
            break
        for j in range(3000):
            eval = C*i + D*j
            if eval > lim:
                break
            elif eval > ans:
                ans = eval
    return ans

A, B, C, D, E, F = map(int,input().split())
# E(A+B) >= C+D, 100A+100B+C+D <= Fを満たす中での(C+D)/(100A+100B+C+D)の最大化
water = [] #ありうる(A, B)の組
waterlen = 0
ans = [0, 0]
noudo = 0
for i in range(30):
    for j in range(30):
        val = 100*A*i + 100*B*j
        if val <= F:
            water.append(val)
            waterlen += 1
        else:
            break
water.pop(0)
waterlen -= 1
for i in range(waterlen):
    sugarlim = min(water[i] // 100 * E, F-water[i])
    sugar = solve(C, D, sugarlim)
    
    val = 100*sugar/(water[i]+sugar)
    if val > noudo:
        noudo = val
        ans[0] = water[i] + sugar
        ans[1] = sugar
print(*ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

A, B, C, D, E, F = map(int, input().split())
conc = 0
water, sugar = 0, 0
for i, j, k, l in product(range(F // (100*A) + 1), range(F // (100*B) + 1), range(F // C + 1), range(F // D + 1)):
    wt = 100*(A*i + B*j)
    sg = C*k + D*l
    sugar_water = wt + sg
    if sugar_water == 0:
        continue
    if sg <= wt*E // 100 and sugar_water <= F:
        temp = 100*sg/sugar_water
        if conc < temp:
            conc = temp
            water, sugar = wt, sg
print(water+sugar, sugar)

Submission status: Wrong Answer

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

ans = [0,3000]

for a in range(31):
    for b in range(31):
        if a*A+b*B==0 or a*A+b*B>=F:
            continue
        for c in range((3000//C)+1):
            if c*C>E*(a*A+b*B) or (a*A+b*B)*100+c*C>F:
                continue
            d = min((E*(a*A+b*B)-c*C)//D,(F-((a*A+b*B)*100+c*C))//D)
            if (a*A+b*B)*100+(c*C+d*D)>F or c*C+d*D>(a*A+b*B)*E:
                continue
            ans_tmp = [c*C+d*D,(a*A+b*B)*100]
            if ans_tmp[0]*ans[1] > ans[0]*ans_tmp[1]:
                ans = ans_tmp
print(ans[1]+ans[0],ans[0])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+5):
    for j in range(int(maxwater//100+2)//min(a,b)+5):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100)

Submission status: Wrong Answer

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

maxn = .0
total, sato = 0, 0
for _a in range(0, f, 100*a):
  for _b in range(0, f-_a, 100*b):
    if _a == 0 and _b == 0:
      continue
    for _c in range(0, f-_a-_b, c):
      for _d in range(0, f-_a-_b-_c, d):
        if ((_a + _b) // 100) * e < _c + _d:
          break
        if 100 * (_c + _d) / (_a + _b + _c + _d) >= maxn:
          maxn = 100 * (_c + _d) / (_a + _b + _c + _d)
          total = _a + _b + _c + _d
          sato = _c + _d
print(total, sato)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=[int(i) for i in input().split(' ')]
ans = 0.0
maxx = 0
maxy = 0
for i in range(0, 31):
  for j in range(0, 31):
    if i * a * 100 + j * b * 100 > f:
      continue
    for k in range(0, 3001):
      if i * a * 100 + j * b * 100 + k * c > f:
        continue
      for l in range(0, 3001):
        if i * a * 100 + j * b * 100 + k * c + l * d > f:
          continue
        if (i * a + j * b) * e < k * c + l * d:
          continue
        x = 100 * a * i + 100 * b * j
        y = k * c + l * d
        if (not x + y == 0) and (x + y) * ans < y:
          ans = max(ans, y / (x + y))
          maxx = x
          maxy = y
print(maxx + maxy, maxy)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split(' '))
waters=[]
for i in range(F//100+1):
	for j in range(F//100+1):
		if i==j==0:
			continue
		elif 100*(A*i+B*j)<=F:
			waters.append(100*(A*i+B*j))
		else:
			break
sugarwaters=[]
waters=list(set(waters))
for water in waters:
	for k in range(F-water+1):
		l = (min(F-water, water*E*0.01) - C*k)//D
		sugar = C*k+D*l
		sugarwaters.append([sugar/water, sugar+water, sugar])
sugarwaters = sorted(sugarwaters, key=lambda x: x[0])[::-1]
print(int(sugarwaters[0][1]), int(sugarwaters[0][2]))

Submission status: Wrong Answer

Solution code:
from itertools import product
a,b,c,d,e,f = map(int, input().split())
k = range(f//a//100+1)
l = range(f//b//100+1)
m = range(f//c+1)
n = range(f//d+1)
s = 0
wat,sug = 0,0
for w,x,y,z in product(k,l,m,n):
  if (w,x,y,z) == (0,0,0,0):
    continue
  if (w*a+x*b)*100+y*c+z*d <= f and (w*a+x*b)*e >= y*c+z*d:
    den = (y*c+z*d)*100/((w*a+x*b)*100+y*c+z*d)
    if den > s:
      s = den
      wat,sug = (w*a+x*b)*100+y*c+z*d , y*c+z*d
print(wat,sug)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
A,B,C,D,E,F = map(int, input().split())
ans = {"w":A*100, "s":0}
def density(water, sugar):
    return 100*sugar/(water+sugar)

G = gcd(C,D)
for a in range(31):
    for b in range(31):
        water = (a*A+b*B)*100
        if water>F:
            continue
        max_sugar = min((a*A+b*B)*E, F-water)
        sugar = int(G*(max_sugar//G))
        if sugar<min(C,D): continue
        if water+sugar==0: 
            continue
        if density(water, sugar)>density(ans["w"], ans["s"]):
            ans["w"] = water
            ans["s"] = sugar
            print(water, sugar)
print(ans["w"]+ans["s"], ans["s"])

Submission status: Wrong Answer

Solution code:
from fractions import gcd
A,B,C,D,E,F = map(int, input().split())
ans = {"w":A*100, "s":0}
def density(water, sugar):
    return 100*sugar/(water+sugar)

G = gcd(C,D)
for a in range(31):
    for b in range(31):
        water = (a*A+b*B)*100
        if water>F:
            continue
        max_sugar = min((a*A+b*B)*E, F-water)
        sugar = int(G*(max_sugar//G))
        if water+sugar==0: 
            continue
        if density(water, sugar)>density(ans["w"], ans["s"]):
            ans["w"] = water
            ans["s"] = sugar
print(ans["w"]+ans["s"], ans["s"])

Submission status: Wrong Answer

Solution code:
from fractions import gcd
A,B,C,D,E,F = map(int, input().split())
ans = {"w":A*100, "s":0}
def density(water, sugar):
    return 100*sugar/(water+sugar)

G = gcd(C,D)
for a in range(F//(100*A)+1):
    for b in range(F//(100*B)+1):
        water = (a*A+b*B)*100
        if water>F:
            continue
        max_sugar = min((a*A+b*B)*E, F-water)
        sugar = int(G*(max_sugar//G))
        if water+sugar==0: 
            continue
        if density(water, sugar)>density(ans["w"], ans["s"]):
            ans["w"] = water
            ans["s"] = sugar
print(ans["w"]+ans["s"], ans["s"])

Submission status: Wrong Answer

Solution code:
from fractions import gcd
A,B,C,D,E,F = map(int, input().split())
ans = {"w":A*100, "s":0}
def density(water, sugar):
    return 100*sugar/(water+sugar)

G = gcd(C,D)
for a in range(F//(100*A)+1):
    for b in range(F//(100*B)+1):
        water = (a*A+b*B)*100
        if water>F:
            continue
        max_sugar = min((a*A+b*B)*E, F-water)
        sugar = G*(max_sugar//G)
        if water+sugar==0: 
            continue
        if density(water, sugar)>density(ans["w"], ans["s"]):
            ans["w"] = water
            ans["s"] = sugar
print(ans["w"]+ans["s"], ans["s"])