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())

sugar = set()
water = set()

for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        w = 100 * A * i + 100 * B * j
        if 0 < w <= F:
            water.add(w)

for i in range(F//C + 1):
    for j in range(F//D + 1):
        s = C * i + D * j
        if s <= F:
            sugar.add(s)

ans_w = 0
ans_s = 0
conc = 0
for s in sugar:
    for w in water:
        if s + w > F:
            continue
        if s > w * E / 100:
            continue
        tmp = s / (s + w) * 100
        if tmp > conc:
            conc = tmp
            ans_w = w
            ans_s = s

print(ans_s + ans_w, ans_s)

Submission status: Wrong Answer

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

sugar = set()
water = set()

for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        w = 100 * A * i + 100 * B * j
        if w <= F:
            water.add(w)

for i in range(F//C + 1):
    for j in range(F//D + 1):
        s = C * i + D * j
        if s <= F:
            sugar.add(s)

ans_w = 0
ans_s = 0
conc = 0
for s in sugar:
    for w in water:
        if s == w == 0:
            continue
        if s + w > F:
            continue
        if s > w * E / 100:
            continue
        tmp = s / (s + w) * 100
        if tmp > conc:
            conc = tmp
            ans_w = w
            ans_s = s

print(ans_s + ans_w, ans_s)

Submission status: Wrong Answer

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

sugar = set()
water = set()

for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        w = 100 * A * i + 100 * B * j
        if w > F:
            break
        water.add(w)

for i in range(F//C + 1):
    for j in range(F//D + 1):
        s = C * i + D * j
        if s <= F:
            sugar.add(s)

ans_w = 0
ans_s = 0
conc = 0
for s in sugar:
    for w in water:
        if s == w == 0:
            continue
        if s + w > F:
            continue
        if s > w * E / 100:
            continue
        tmp = s / (s + w) * 100
        if tmp > conc:
            conc = tmp
            ans_w = w
            ans_s = s

print(ans_s + ans_w, ans_s)

Submission status: Wrong Answer

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

sugar = set()
water = set()

for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        w = 100 * A * i + 100 * B * j
        if w > F:
            break
        water.add(w)

for i in range(F//C + 1):
    for j in range(F//D + 1):
        s = C * i + D * j
        if s <= F:
            sugar.add(s)

ans_w = 0
ans_s = 0
conc = 0
for s in sugar:
    for w in water:
        if w == 0:
            continue
        if s + w > F:
            continue
        if s / w > E / 100:
            continue
        tmp = s / (s + w) * 100
        if tmp > conc:
            conc = tmp
            ans_w = w
            ans_s = s

print(ans_s + ans_w, ans_s)

Submission status: Wrong Answer

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

ans_water = 0;
ans_suger = 0;
max_dens = 0;
try:
    for a in range(0, F+1, 100*A):
        for b in range(0, F-a+1, 100*B):
            water = a+b
            for c in range(0, E*water//100, C):
                for d in range(0, E*water//100-c+1, D):
                    suger = c+d
                    dens = 100*suger/(water+suger)
                    if water+suger <=F and suger <=E*water//100 and dens > max_dens:
                            max_dens = dens
                            ans_water = water
                            ans_suger = suger
                            if suger == E*water//100:
                                raise Exception
except Exception:
    pass

print(ans_water+ans_suger, ans_suger)

Submission status: Wrong Answer

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

sugar = set()
water = set()

for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        w = 100 * A * i + 100 * B * j
        if w > F:
            break
        water.add(w)

for i in range(F//C + 1):
    for j in range(F//D + 1):
        s = C * i + D * j
        if s <= F:
            sugar.add(s)

ans_w = 0
ans_s = 0
conc = 0
for s in sorted(sugar):
    for w in sorted(water):
        if w == 0:
            continue
        if s + w > F:
            break
        if s / w > E / 100:
            break
        tmp = s / (s + w) * 100
        if tmp > conc:
            conc = tmp
            ans_w = w
            ans_s = s

print(ans_s + ans_w, ans_s)

Submission status: Wrong Answer

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

ans_water = 0;
ans_suger = 0;
max_dens = 0;
try:
    for a in range(0, F, 100*A):
        for b in range(0, F-a+1, 100*B):
            water = a+b
            for c in range(0, E*water//100, C):
                for d in range(0, E*water//100-c+1, D):
                    suger = c+d
                    dens = 100*suger/(water+suger)
                    if water+suger <=F and suger <=E*water//100 and dens > max_dens:
                            max_dens = dens
                            ans_water = water
                            ans_suger = suger
                            if suger == E*water//100:
                                raise Exception
except Exception:
    pass

print(ans_water+ans_suger, ans_suger)

Submission status: Wrong Answer

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

sugar = set()
water = set()

for i in range(F):
    for j in range(F):
        w = 100 * A * i + 100 * B * j
        if w <= F:
            water.add(w)

for i in range(F):
    for j in range(F):
        s = C * i + D * j
        if s <= F:
            sugar.add(s)

ans_w = 0
ans_s = 0
conc = 0
for s in sugar:
    for w in water:
        if w == 0:
            continue
        if s + w > F:
            continue
        if s / w > E / 100:
            continue
        tmp = s / (s + w) * 100
        if tmp > conc:
            conc = tmp
            ans_w = w
            ans_s = s

print(ans_s + ans_w, ans_s)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_concent = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
max_concent = 0

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)
    print(sugar_vars)
    for sugar in sugar_vars:
        concent = sugar * 100 / (sugar + water)
        print(concent)
        if concent == target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif max_concent <= concent < target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            max_concent = concent
        elif concent > target_concent:
            break
    if break_all:
        break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_concent = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
max_concent = 0

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)
    for sugar in sugar_vars:
        concent = sugar * 100 / (sugar + water)
        if concent == target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif max_concent < concent < target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            max_concent = concent
    if break_all:
        break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_concent = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
max_concent = 0

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)
    for sugar in sugar_vars:
        concent = sugar * 100 / (sugar + water)
        if concent == target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif max_concent < concent < target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            max_concent = concent
        elif concent > target_concent:
            break
    if break_all:
        break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_concent = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
max_concent = 0

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)[1:]
    for sugar in sugar_vars:
        concent = sugar * 100 / (sugar + water)
        if concent == target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif max_concent < concent < target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            max_concent = concent
        elif concent > target_concent:
            break
    if break_all:
        break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_rate = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]
ans_solution = 0
ans_sugar = 0
min_rate_dest = 100

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)
    for sugar in sugar_vars:
        rate = sugar * 100 / (sugar + water)
        if target_rate - rate == 0:
            ans_solution = water + sugar
            ans_sugar = sugar
            break
        elif 0 < target_rate - rate < min_rate_dest:
            ans_solution = water + sugar
            ans_sugar = sugar
            min_rate_dest = target_rate - rate
        else:
            break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_rate = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
min_rate_dest = 100

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)[1:]
    for sugar in sugar_vars:
        rate = sugar * 100 / (sugar + water)
        if target_rate - rate == 0:
            ans_solution = water + sugar
            ans_sugar = sugar
            break
        elif 0 < target_rate - rate < min_rate_dest:
            ans_solution = water + sugar
            ans_sugar = sugar
            min_rate_dest = target_rate - rate
        else:
            break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_rate = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
min_rate_dest = 100

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)[1:]
    for sugar in sugar_vars:
        rate = sugar * 100 / (sugar + water)
        if target_rate - rate == 0:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif 0 < target_rate - rate < min_rate_dest:
            ans_solution = water + sugar
            ans_sugar = sugar
            min_rate_dest = target_rate - rate
        else:
            break
    if break_all:
        break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_rate = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
min_rate_dest = 100

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)[1:]
    for sugar in sugar_vars:
        rate = sugar * 100 / (sugar + water)
        if target_rate == rate:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif 0 < target_rate - rate < min_rate_dest:
            ans_solution = water + sugar
            ans_sugar = sugar
            min_rate_dest = target_rate - rate
        else:
            break
    if break_all:
        break

print(ans_solution, ans_sugar)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
max_a = f // (100*a)
max_b = f // (100*b)
max_c = f // c
max_d = f // d
wat = []
sug = []
for i in range(max_a + 1):
    for j in range(max_b + 1):
        w = 100 * a * i + 100 * b * j
        if w <= f and w > 0:
            wat.append(w)
for i in range(max_c + 1):
    for j in range(max_d + 1):
        s = c*i + d*j
        if s < f:
            sug.append(s)
ans = 0
for x in wat:
    for y in sug:
        if x + y <= f and y <= e * x // 100:
            if ans <= 100 * y // (x + y):
                ans =  100 * y // (x + y)
                out = [x+y, y]
print(*out)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=list(map(int,input().split()))
val=0
lst=[0,0]
for i in range(31):
	for j in range(31):
		for k in range(101):
			for l in range(101):
				wtr=100*i*a+100*j*b
				sgr=k*c+l*d
				if wtr==0 or wtr>f or sgr>f or wtr+sgr>f:
					break
				else:
					if sgr/(sgr+wtr)<=e/(e+100) and sgr/(sgr+wtr)>val:
						val=sgr/(sgr+wtr)
						lst[0]=sgr
						lst[1]=sgr+wtr
			
print(lst[1],lst[0])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=list(map(int,input().split()))
val=0
lst=[0,0]
for i in range(31):
	for j in range(31):
		for k in range(101):
			for l in range(101):
				wtr=100*i*a+100*j*b
				sgr=k*c+l*d
				if wtr==0 or wtr>f or sgr>f or wtr+sgr>f:
					break
				else:
					if sgr/(sgr+wtr)<=e/(e+100) and sgr/(sgr+wtr)>val:
						val=sgr/(sgr+wtr)
						lst[0]=sgr
						lst[1]=sgr+wtr
			
print(lst[0],lst[1])

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=list(map(int,input().split()))
def dns(x,y):
	return 100*x/(x+y)
val,lqd,sld=0,0,0
for i in range(31):
	for j in range(31):
		for k in range(101):
			for l in range(101):
				wtr=100*i*a+100*j*b
				sgr=k*c+l*d
				if wtr==0 or wtr>f or sgr>f or wtr+sgr>f:
					break
				else:
					if dns(sgr,wtr)<100*e/(e+100) and dns(sgr,wtr)>val:
						val=dns(sgr,wtr)
						lqd=sgr+wtr
						sld=sgr
print(lqd,sld)

Submission status: Wrong Answer

Solution code:
import sys
a,b,c,d,e,f=list(map(int,input().split()))
conc,val1,val2=0,0,0
for i in range(31):
	for j in range(31):
		for k in range(31):
			for l in range(31):
				water=a*100*i+b*100*j
				suger=c*k+d*l
				if water==0:
					break
				if suger>e*(a*i+b*j):
					break
				if suger+water>f:
					break
				if conc < (suger)/(water+suger):
					val1,val2=suger+water,suger
					print(val1,val2)
					sys.exit()
print(val1,val2)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=list(map(int,input().split()))
conc,val1,val2=0,0,0
for i in range(31):
	for j in range(31):
		for k in range(31):
			for l in range(31):
				water=a*100*i+b*100*j
				suger=c*k+d*l
				if water==0:
					break
				if suger>e*(a*i+b*j):
					break
				if suger+water>f:
					break
				if conc < (suger)/(water+suger):
					val1,val2=suger+water,suger
print(val1,val2)

Submission status: Wrong Answer

Solution code:
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def calc(water, salt):
    if salt / water <= e / 100 and water + salt <= f:
        return True
    else:
        return False


a, b, c, d, e, f = na()
w = 100 * a
s = 0
while calc(w, s):
    if s * 100 == e * w:
        break
    if calc(w, s+d):
        s += d
        continue
    if calc(w, s+c):
        s += c
        continue
    if calc(w + 100 * b, s):
        w += 100 * b
        continue
    if calc(w + 100 * a, s):
        w += 100 * a
        continue
    break
print(s + w, s)

Submission status: Wrong Answer

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

ans = [0,0]
maxconc = 0
for i in range(31):
    for j in range(31):
        water = A*i + B*j
        if 100 * water > F:continue
        loopk = E*water // C + 1
        
        for k in range(loopk):
            loopl = (E*water-C*k)// D + 1
            for l in range(loopl):
                sugar = C*k + D*l
                if 100*water + sugar > F or 100*water + sugar == 0:continue
                if sugar <= water * E:
                    conc = (sugar)/(sugar+100*water)
                    if conc > maxconc:
                        ans = [100*water+sugar,sugar]
                        maxconc = conc
                    
print(*ans)

Submission status: Wrong Answer

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

water = set()
for a in range(0,F,100*A):
    for b in range(0,F,100*B):
        if a + b != 0 and a+b <= F:
            water.add(a+b)


max_consist = 0
ans = (0,0)
for w in water:
    ab = w //100
    sugar_max = E * ab
    x = sugar_max // C
    y = sugar_max // D
    s = max(C*i + D*j for i in range(x+1) for j in range(y+1) if C*i + D*j <= sugar_max)
    if w + s <= F:
        cur_consist = (100*s)/(w+s)
        if max_consist < cur_consist:
            max_consist = cur_consist
            ans = (w + s,s)

print(*ans)

Submission status: Wrong Answer

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

S = [0] * 1501
for i in range(1500//c + 1):
    for j in range(1500//d + 1):
        if c * i + d * j <= 1500:
            S[c * i + d * j] = 1

S2 = [0] * 1501
t = 0
for i in range(1501):
    if S[i] == 1:
        t = i
    S2[i] = t

#print(S2[:100])

ans = [0, 0, 0]
for i in range(30):
    for j in range(30):
        water = i * 100 * a + j * 100 * b
        if 0 < water <= f:
            sugar_max = min(f - water, water * e * 0.01)
            sugar = S2[int(sugar_max)]
            noudo = sugar / (water + sugar)
            #print(i, j, water, sugar_max, sugar, noudo)
            if noudo > ans[0]:
                #print(i, j, sugar)
                ans[0] = noudo
                ans[1] = water + sugar
                ans[2] = sugar

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

Submission status: Wrong Answer

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

S = [0] * 1501
for i in range(1500//c + 1):
    for j in range(1500//d + 1):
        if c * i + d * j <= 1500:
            S[c * i + d * j] = 1

S2 = [0] * 1501
t = 0
for i in range(1501):
    if S[i] == 1:
        t = i
    S2[i] = t

#print(S2[:100])

ans = [0, 0, 0]
for i in range(30):
    for j in range(30):
        water = i * 100 + j * 100
        if 0 < water <= f:
            sugar_max = min(f - water, water * e * 0.01)
            sugar = S2[int(sugar_max)]
            noudo = sugar / (water + sugar)
            #print(i, j, water, sugar_max, sugar, noudo)
            if noudo > ans[0]:
                ans[0] = noudo
                ans[1] = water + sugar
                ans[2] = sugar

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

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int, input().split()) 
x=0
y=0
#ans1 水　ans2 砂糖
ans1=1
ans2=0
for i in range(31):
    for j in range(31):
        x=100*(a*i+b*j)
        if x>=f:
            continue
        if x==0:
            continue
        
        for k in range(f//c+1):
            for l in range(f//(c+d)+1):
                y=c*k+d*l
                
                if x+y>=f or y/(x+y)>e/(100+e):
                    continue
                
                else:
                    if y/(x+y)>=ans2/(ans1+ans2):
                        ans1=x
                        ans2=y
                    else:
                        continue
if x+y!=0:
    print(ans1+ans2,ans2)
else:
    print(a,0)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int, input().split()) 
x=0
y=0
ans1=1
ans2=0
for i in range(1,31):
    for j in range(31):
        x=100*(a*i+b*j)
        if x>=f:
            continue
        
        for k in range(1,f//c+1):
            for l in range(f//(c+d)+1):
                y=c*k+d*l
                if x+y>=f or y/(x+y)>e/(100+e):
                    continue
                
                
                else:
                    if y/(x+y)>=ans2/(ans1+ans2):
                        ans1=x
                        ans2=y
                    else:
                        continue
if x+y!=0:
    print(ans1+ans2,ans2)
else:
    print(a,0)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int, input().split()) 
x=0
y=0
ans1=1
ans2=0
for i in range(1,31):
    for j in range(31):
        x=100*(a*i+b*j)
        if x>=f:
            continue
        
        for k in range(1,f//c+1):
            for l in range(f//(c+d)+1):
                y=c*k+d*l
                if x+y>=f or y/(x+y)>e/(100+e):
                    continue
                
                
                else:
                    if y/(x+y)>=ans2/(ans1+ans2):
                        ans1=x
                        ans2=y
                    else:
                        continue
print(ans1+ans2,ans2)

Submission status: Wrong Answer

Solution code:

a,b,c,d,e,f=map(int, input().split()) 
x=0
y=0
ans1=1
ans2=0
for i in range(1,31):
    for j in range(31):
        x=100*(a*i+b*j)
        if x>=f:
            continue
        
        for k in range(1,3000):
            for l in range(3000):
                y=c*k+d*l
                if x+y>=f or y/(x+y)>e/(100+e):
                    continue
                
                else:
                    if y/(x+y)>ans2/(ans1+ans2):
                        ans1=x
                        ans2=y
                    else:
                        continue
print(ans1+ans2,ans2)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
sato = set()
miz = set()
for i in range(F//100//A + 1):
	for j in range(F//100//B + 1):
		if i*A + j*B <= F//100:
			miz.add((i*A + j*B)*100)

for i in range(F//C + 1):
	for j in range(F//D + 1):
		if i*C + j*D <= F:
			sato.add(i*C + j*D)
miz = list(miz)
sato = list(sato)
#print(sorted(miz), sorted(sato))
node = 0
note = [0, 0]
for i in range(len(miz)):
	if miz[i] == 0:
		continue
	for j in range(len(sato)):
		c = 100*sato[j]/miz[i]
		q = miz[i] + sato[j]
		if c > E:
			pass
		elif q > F:
			pass
		elif c > node:
			note = [miz[i] + sato[j], sato[j]]
			node = c

print(*note)

Submission status: Wrong Answer

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

n = 30

noudo = -1
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int((i*e)/c)+1):
        e_sato = min(f - i*100, i*e-j*c)
        d_num = e_sato // d
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False
"""
if all_s == -1:
    print(100*a,0)
    exit()
"""
print(all_s,sato_s)

Submission status: Wrong Answer

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

n = 30

noudo = -1
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int((i*e)/c)+1):
        e_sato = min(f - i*100, i*e-j*c)
        d_num = e_sato // d
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False

if all_s == -1:
    print(100*a,0)
    exit()

print(all_s,sato_s)

Submission status: Wrong Answer

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

n = 30

noudo = -1
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int((i*e)/c)+1):
        #a = f - (i*e-j*c) - i*100
        d_num = (i*e - j*c) // d
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False

if all_s == -1:
    print(100*a,0)
    exit()

print(all_s,sato_s)

Submission status: Wrong Answer

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

n = 30

noudo = -1
all_s = 0
sato_s = 0

r_flag = False

for i in range(1,(f+99)//100):
    for j in range(30+1):
        if r_flag == True:
            break
        for k in range(30+1):
            if i == j*a+k*b:
                r_flag = True
                break
    if r_flag == False:
        continue
    for j in range(int(i*e/c)+1):
        d_num = (i*e - j*c) // d
        if d_num < 0:
            break
        tmp_sato = j*c+d_num*d
        tmp_all = tmp_sato + i*100
        tmp_noudo = (100*(tmp_sato)) / tmp_all
        if tmp_all > f:
            break
        if noudo < tmp_noudo:
            noudo = tmp_noudo
            all_s = tmp_all
            sato_s = tmp_sato
    r_flag = False

if all_s == -1:
    print(100*a,0)
    exit()

print(all_s,sato_s)