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:
import math

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


def sug_par(suiyou, nodo, wat, sug):
    # suiyou = i
    # nodo = DP[i]
    # wat = 100A or 100B
    # sug = C or D

    if int(suiyou + (100 * wat)) == 0:
        return 101
    else:
        return int(math.floor(((((nodo / 100) * suiyou) + sug) * 100) / (suiyou + (100 * wat))))


DP = [-1] * (F + 1)
DP[0] = 0

flag_A = True
flag_B = True
flag_C = True
flag_D = True

while flag_A or flag_B or flag_C or flag_D:

    flag_A = False
    flag_B = False
    flag_C = False
    flag_D = False

    for i in reversed(range(F + 1)):
        if DP[i] != -1:
            if i + 100 * A <= F and sug_par(i, DP[i], A, 0) <= (E*100/(100+E)) and DP[i + 100 * A] < sug_par(i, DP[i], A, 0):
                DP[i + 100 * A] = max(DP[i + 100 * A], sug_par(i, DP[i], A, 0))
                flag_A = True
            if i + 100 * B <= F and sug_par(i, DP[i], B, 0) <= (E*100/(100+E)) and DP[i + 100 * B] < sug_par(i, DP[i], B, 0):
                DP[i + 100 * B] = max(DP[i + 100 * B], sug_par(i, DP[i], B, 0))
                flag_B = True
            if i + C <= F and sug_par(i, DP[i], 0, C) <= (E*100/(100+E)) and DP[i + C] < sug_par(i, DP[i], 0, C):
                DP[i + C] = max(DP[i + C], sug_par(i, DP[i], 0, C))
                flag_C = True
            if i + D <= F and sug_par(i, DP[i], 0, D) <= (E*100/(100+E)) and DP[i + D] < sug_par(i, DP[i], 0, D):
                DP[i + D] = max(DP[i + D], sug_par(i, DP[i], 0, D))
                flag_D = True

max_i = DP.index(max(DP))
print(max_i,DP[max_i]*max_i//100)

Submission status: Wrong Answer

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

Water = []
for i in range(0, f // (a * 100) + 1):
  for j in range(0, f // (b * 100) + 1):
    if (i * a + j * b) * 100 <= f:
      Water.append((i * a + j * b) * 100)
#print(list(set(Water)))

Solt = []
for i in range(0, int((f * e / 100) / c) + 2):
  for j in range(0, int((f * e / 100) / d) + 2):
    if i * c + j * d <= (f * e / 100):
      Solt.append(i * c + j * d)
#print(list(set(Solt)))

max_cnc = 0
champ_w = 0
champ_s = 0
from itertools import product 
for pair in product(list(set(Water[1:])), list(set(Solt[1:]))):
#  print(pair[0], pair[1])
  vol = pair[0] + pair[1]
  if vol > f:
    continue
  if pair[1] * 100 / pair[0] > e:
    continue
  cnc = pair[1] * 100 / (pair[0] + pair[1])
#  print(pair[0], pair[1], cnc)
  max_cnc = max(cnc, max_cnc)
  if cnc == max_cnc:
    champ_w = pair[0]
    champ_s = pair[1]
print(champ_w + champ_s, champ_s)

Submission status: Wrong Answer

Solution code:
import sys
import math
a, b, c, d, e, f = [int(i) for i in sys.stdin.readline().split()]
max_sugar = 0
max_sum = 0
max_noudo = 0
for _a in range(f // a):
    max_b = math.floor((f - _a * a * 100) / b) + 1
    for _b in range(max_b):
        water = (_a * a + _b * b) * 100
        max_c = math.floor(min(f - water, (_a * a + b * _b) * e)) + 1
        for _c in range(max_c):
            _d = max(0, min((f - water - _c * c) // d, ((_a * a + _b * b) * e - _c * c) // d))
            if _c + _d == 0:
                continue
            if (_a * a + _b * b) * 100 + _c * c + _d * d > f:
                continue
            noudo = (c * _c + d * _d) / ((_a*a + _b*b) * 100)
            if noudo > e / 100:
                continue
            elif noudo > max_noudo:
                max_sugar = _c * c + _d * d
                max_sum = (_a*a + _b*b) * 100 + max_sugar
                max_noudo = noudo
print(max_sum, max_sugar)

Submission status: Wrong Answer

Solution code:
import sys
import math
a, b, c, d, e, f = [int(i) for i in sys.stdin.readline().split()]
max_sugar = 0
max_sum = 0
max_noudo = 0
for _a in range(f // a):
    for _b in range((f - _a * 100) // b):
        water = (_a + _b) * 100
        max_c = math.floor(min(f - water, (_a + _b) * e)) + 1
        for _c in range(max_c):
            _d = max(0, min((f - water - _c * c) // d, ((_a + _b) * e - _c * c) // d))
            if _c + _d == 0:
                continue
            if (_a + _b) * 100 + _c * c + _d * d > f:
                continue
            noudo = (c * _c + d * _d) / ((_a + _b) * 100)
            if noudo > e / 100:
                continue
            elif noudo > max_noudo:
                max_sugar = _c * c + _d * d
                max_sum = (_a + _b) * 100 + max_sugar
                max_noudo = noudo
print(max_sum, max_sugar)

Submission status: Wrong Answer

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

CONCENT_LIMIT = E/(100+E)
max_concent = 0
water_at_max = 0
sugar_at_max = 0
for num_b in range(F//(100*B)+1):
#     print("B: ", num_b)
    rest_cap = F - num_b*B*100
    if rest_cap < 0:
        continue
        
    for num_a in range(rest_cap//(100*A)+1):
#         print("A: ", num_a)
        rest_cap_ = rest_cap - num_a*A*100
        water = num_b*B*100+num_a*A*100
        if (rest_cap_ <= 0) or (water == 0):
            continue
            
        for num_d in range(rest_cap_//D+1):
#             print("D: ", num_d)
            rest_cap__ = rest_cap_ - num_d*D
            if rest_cap__ < 0:
                continue
                
            for num_c in range(rest_cap__//C+1):
#                 print("C: ", num_c)
                sugar = num_d*D+num_c*C
                if water+sugar > F:
                    continue
                concent = sugar / (water+sugar)

                if (concent <= CONCENT_LIMIT) & (concent > max_concent):
                    max_concent = concent
                    sugar_at_max = sugar
                    water_at_max = water
                
print(water_at_max+sugar_at_max, end=" ")
print(sugar_at_max)

Submission status: Wrong Answer

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

CONCENT_LIMIT = E/(100+E)
max_concent = 0
water_at_max = 0
sugar_at_max = 0
for num_b in range(F//(100*B)+1):
    print("B: ", num_b)
    rest_cap = F - num_b*B*100
    if rest_cap < 0:
        continue
        
    for num_a in range(rest_cap//(100*A)+1):
        print("A: ", num_a)
        rest_cap_ = rest_cap - num_a*A*100
        water = num_b*B*100+num_a*A*100
        if (rest_cap_ <= 0) or (water == 0):
            continue
            
        for num_d in range(rest_cap_//D+1):
            print("D: ", num_d)
            rest_cap__ = rest_cap_ - num_d*D
            if rest_cap__ < 0:
                continue
                
            for num_c in range(rest_cap__//C+1):
                print("C: ", num_c)
                sugar = num_d*D+num_c*C
                if water+sugar > F:
                    continue
                concent = sugar / (water+sugar)

                if (concent <= CONCENT_LIMIT) & (concent > max_concent):
                    max_concent = concent
                    sugar_at_max = sugar
                    water_at_max = water
                
print(water_at_max+sugar_at_max, end=" ")
print(sugar_at_max)

Submission status: Wrong Answer

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

CONCENT_LIMIT = E/(100+E)
max_concent = 0
water_at_max = 0
sugar_at_max = 0
for num_b in range(F//(100*B)+2):
    rest_cap = F - num_b*B*100
    if rest_cap < 0:
        continue
        
    for num_a in range(rest_cap//(100*A)+2):
        rest_cap_ = rest_cap - num_a*A*100
        water = num_b*B*100+num_a*A*100
        if (rest_cap_ < 0) or (water == 0):
            continue
            
        for num_d in range(rest_cap_//D+2):
            rest_cap__ = rest_cap_ - num_d*D
            if rest_cap__ < 0:
                continue
                
            for num_c in range(rest_cap__//C+2):
                sugar = num_d*D+num_c*C
                if water+sugar > F:
                    continue
                concent = sugar / (water+sugar)
                if concent > CONCENT_LIMIT:
                    continue
                if concent > max_concent:
                    max_concent = concent
                    sugar_at_max = sugar
                    water_at_max = water
                
print(water_at_max+sugar_at_max, end=" ")
print(sugar_at_max)

Submission status: Wrong Answer

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

CONCENT_LIMIT = E/(100+E)
max_concent = 0
water_at_max = 0
sugar_at_max = 0
for num_b in range(F//(100*B)+1):
    rest_cap = F - num_b*B*100
    if rest_cap < 0:
        continue
        
    for num_a in range(rest_cap//(100*A)+1):
        rest_cap_ = rest_cap - num_a*A*100
        water = num_b*B*100+num_a*A*100
        if (rest_cap_ < 0) or (water == 0):
            continue
            
        for num_d in range(rest_cap_//D+1):
            rest_cap__ = rest_cap_ - num_d*D
            if rest_cap__ < 0:
                continue
                
            for num_c in range(rest_cap__//C+2):
                sugar = num_d*D+num_c*C
                if water+sugar > F:
                    continue
                concent = sugar / (water+sugar)
                if concent > CONCENT_LIMIT:
                    continue
                if concent > max_concent:
                    max_concent = concent
                    sugar_at_max = sugar
                    water_at_max = water
                
print(water_at_max+sugar_at_max, end=" ")
print(sugar_at_max)

Submission status: Wrong Answer

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

CONCENT_LIMIT = E/(100+E)
max_concent = 0
water_at_max = 0
sugar_at_max = 0
for num_b in range(F//(100*B)+1):
    rest_cap = F - num_b*B*100
    if rest_cap < 0:
        continue
    for num_a in range(rest_cap//(100*A)+1):
        rest_cap_ = rest_cap - num_a*A*100
        water = num_b*B*100+num_a*A*100
        if rest_cap_ < 0:
            continue
        if water == 0:
            continue
        for num_d in range(rest_cap_//D+1):
            rest_cap__ = rest_cap_ - num_d*D
            if rest_cap__ < 0:
                continue
            for num_c in range(rest_cap__//C+1):
                sugar = num_d*D+num_c*C
                if water+sugar > F:
                    continue
                concent = sugar / (water+sugar)
                if concent > CONCENT_LIMIT:
                    continue
                if concent > max_concent:
                    max_concent = concent
                    sugar_at_max = sugar
                    water_at_max = water
                
print(water_at_max+sugar_at_max, end=" ")
print(sugar_at_max)

Submission status: Wrong Answer

Solution code:
import math
a,b,c,d,e,f = map(int,input().split())
ans = [202,2]
ConMax = 0
for i in range(0, max(1,(f//(a*100)))):
    for j in range(0,max(1,(f//(b*100)-i*a))):
        if i+j == 0:
            continue
        for k in range(0, ((i*a+j*b)*e)//c):
            for m in range(0, (((i*a+j*b)*e)-c*k)//d+1):
                ConTmp = 100*(k*c+m*d)/(k*c+m*d+100*(i*a+j*b))
                if 100*a*i+100*b*j+c*k+d*m <= f and ConTmp <= 100*e/(100+e) and ConTmp>ConMax:
                    ConMax = ConTmp
                    ans = [k*c+m*d+100*(a*i+b*j),k*c+m*d]
print(ans[0],ans[1])

Submission status: Wrong Answer

Solution code:
def examC():
    A, B, C, D, E, F = LI()
    water =set()
    for i in range(30):
        for j in range(30):
            if 100 * (i*A+j*B) >= F or (i==0 and j==0):
                continue
            water.add(100 * (A*i+B*j))
    sugar = set()
    for i in water:
        j = 0
        while(True):
            if (j * C) * 100 > i * E or i+(j*C)>F:
                break
            k = 0
            while(True):
                if (j*C+k*D)*100>i*E or i+(j*C+k*D)>F:
                    j +=1
                    break
                sugar.add((i+j*C+k*D,j*C+k*D))
                k +=1
    ans = [0,0]; cur = float(0)
    for i in sugar:
        if cur<i[1]/i[0]:
            ans = [i[0],i[1]]
            cur = i[1]/i[0]
    print(" ".join(map(str,ans)))
#    print(sugar)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Wrong Answer

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

sugar = []
water = []

for i in range(31):
    for j in range(31):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        
n = int(F/(100+E)*E)

for k in range(n):
    for l in range(n):
        y = C*k+D*l
        if y != 0:    
            sugar.append(y)

ans_water_sugar = 0
ans_sugar = 0
conce = 0 

for s in list(set(sugar)):
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s

print(ans_water_sugar, ans_sugar)

Submission status: Wrong Answer

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

sugar = []
water = []

for i in range(31):
    for j in range(31):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        
n = F//(100+E)*E

for k in range(n):
    for l in range(n):
        y = C*k+D*l
        if y != 0:    
            sugar.append(y)

ans_water_sugar = 0
ans_sugar = 0
conce = 0 

for s in list(set(sugar)):
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s

print(ans_water_sugar, ans_sugar)

Submission status: Wrong Answer

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

sugar = []
water = []

for i in range(100):
    for j in range(100):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        y = C*i+D*j
        if y != 0:    
            sugar.append(y)

ans_water_sugar = 0
ans_sugar = 0
conce = 0 

for s in sugar:
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s

print(ans_water_sugar, ans_sugar)

Submission status: Wrong Answer

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

sugar = []
water = []

for i in range(31):
    for j in range(31):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        y = C*i+D*j
        if y != 0:    
            sugar.append(y)

ans_water_sugar = 0
ans_sugar = 0
conce = 0 

for s in sugar:
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s

print(ans_water_sugar, ans_sugar)

Submission status: Wrong Answer

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

sugar = []
water = []
for i in range(F):
    for j in range(F):
        x = 100*A*i+100*B*j
        if x != 0 and x <= F:
            water.append(x)
        y = C*i+D*j
        if y != 0 and y <= F:    
            sugar.append(y)

ans_water_sugar = 0
ans_sugar = 0
conce = 0 

for s in sugar:
    for w in water:
        if w+s <= F:
            if s/w <= E/100:
                if conce < s/w:
                    conce = s/w
                    ans_water_sugar = s+w
                    ans_sugar = s
print(ans_water_sugar, ans_sugar)

Submission status: Wrong Answer

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

n = F//(100+E)
sugar = (E*n)//C*C+((E*n-(E*n))//C*C)//D*D
water = (100*n)//(100*A)*100*A+(100*n-(100*n)//(100*A)*100*A)//(100*B)*100*B
print(sugar+water, sugar)

Submission status: Wrong Answer

Solution code:
#074c
A,B,C,D,E,F = map(int, input().split())
    
#あり得る水量をすべて書き出す
set_water = set()

for i in range(F//(100*A),-1,-1):
    for j in range((F-(100*A*i))//(100*B),-1,-1):
        water = 100*A*i + 100*B*j
        if water not in set_water:
            set_water.add(water)

#print(set_water)

set_water_and_sugar = set()

def get_conc(water,sugar,E,F):
    if water/100*E < sugar or water+sugar == 0: #water + sugar > F or  …すでに制約済み
        return 0
    else:
        return (100*sugar)/(water+sugar)

      #あり得る水量に対して、ありえる砂糖の量をすべて書き出す (溶け残りの制約があるのでMAXのみではNG)
#for water in set_water:
#    for i in range((F-water)//C,-1,-1):
#        for j in range((F-water-C*i)//D,-1,-1):
#            sugar = C*i + D*j
#            if tuple([water,sugar]) not in set_water_and_sugar:
#                set_water_and_sugar.add(tuple([water,sugar]))              

#あり得る水量に対して、砂糖を限界量(重量制限or溶け残り制限)まで入れる
for water in set_water:
    for i in range((F-water)//C,-1,-1):
        j = min((water/100*E - C*i)//D , (F - water - C*i)//D)
        sugar = C*i + D*j
        if tuple([water,sugar]) not in set_water_and_sugar and sugar >= 0:
            #print(water,sugar,water+sugar,water/100*E)
            set_water_and_sugar.add(tuple([water,sugar]))
            
#最大濃度を求める
limit_conc = (100*E)/(100+E)
max_conc = 0
max_water_and_sugar = [0,0]

for water_and_sugar in set_water_and_sugar:
    water = water_and_sugar[0]
    sugar = water_and_sugar[1]
    conc = get_conc(water,sugar,E,F)
    
    #print(water,sugar,conc)
    
    if max_conc < conc:
        max_conc = conc
        max_water_and_sugar = [water,sugar]
        
        #最高濃度に達したら抜ける
        if max_conc == limit_conc:
            break
        
print(int(sum(max_water_and_sugar)),int(max_water_and_sugar[1]))

Submission status: Wrong Answer

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

L = []
for i in range(f//a//100+1):
    for j in range(f//b//100+1):
        if 0 < 100*(a*i+b*j) < f and 100*(a*i+b*j) not in L:
            L.append(100*(a*i+b*j))
            
D = 0
idx = -1
for i in range(len(L)):
    s = 0
    for j in range(L[i]//c+1):
        for k in range(L[i]//d+1):
            if (c*j+d*k)*100 <= e*L[i] and c*j+d*k+L[i] <= f:
                s = max(s, c*j+d*k)
    if D < s/(L[i]+s):
        D = s/(L[i]+s)
        idx = i
    
if idx >= 0:
    print(int(D*L[idx]/(1-D))+L[idx], int(D*L[idx]/(1-D)))
else:
    print(100*a, 0)

Submission status: Wrong Answer

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

L = []
for i in range(f//a//100+1):
    for j in range(f//b//100+1):
        if 0 < 100*(a*i+b*j) < f and 100*(a*i+b*j) not in L:
            L.append(100*(a*i+b*j))
            
D = 0
idx = -1
for i in range(len(L)):
    s = 0
    for j in range(L[i]//c+1):
        for k in range(L[i]//d+1):
            if (c*j+d*k)*100 <= e*L[i] and c*j+d*k+L[i] <= f:
                s = max(s, c*j+d*k)
    if D < s/(L[i]+s):
        D = s/(L[i]+s)
        idx = i
    
if idx > 0:
    print(int(D*L[idx]/(1-D))+L[idx], int(D*L[idx]/(1-D)))
else:
    print(100*a, 0)

Submission status: Wrong Answer

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

L = []
for i in range(f//a//100+1):
    for j in range(f//b//100+1):
        if 100*(a*i+b*j) <= f and 100*(a*i+b*j) not in L:
            L.append(100*(a*i+b*j))
            
D = 0
idx = -1
for i in range(1, len(L)):
    s = 0
    for j in range(L[i]+1):
        for k in range(L[i]+1):
            if (c*j+d*k)*100 <= e*L[i] and c*j+d*k+L[i] <= f:
                s = max(s, c*j+d*k)
    if D < s/(L[i]+s):
        D = s/(L[i]+s)
        idx = i
    
if idx >= 0:
    print(int(D*L[idx]/(1-D)+L[idx]), int(D*L[idx]/(1-D)))
else:
    print(100*a, 0)

Submission status: Wrong Answer

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

L = []
for i in range(f//a//100+1):
    for j in range(f//b//100+1):
        if 100*(a*i+b*j) <= f and 100*(a*i+b*j) not in L:
            L.append(100*(a*i+b*j))
            
D = 0
idx = -1
for i in range(1, len(L)):
    s = 0
    for j in range(L[i]+1):
        for k in range(L[i]+1):
            if (c*j+d*k)/L[i]*100 <= e and c*j+d*k+L[i] <= f:
                s = max(s, c*j+d*k)
    if D < s/(L[i]+s):
        D = s/(L[i]+s)
        idx = i
    
if idx >= 0:
    print(int(D*L[idx]/(1-D)+L[idx]), int(D*L[idx]/(1-D)))
else:
    print(100*a, 0)

Submission status: Wrong Answer

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

X = []
Y = []
for i in range(F):
    for j in range(F):
        x = A * i + B * j
        if x * 100 <= F:
            X.append(x)
        y = C * i + D * j
        if y <= F:
            Y.append(y)
m = 0
ans = []
for x in X:
    if x == 0: continue
    for y in Y:
        if y == 0: continue
        if x * 100 + y <= F and x * E >= y:
            if m < y / (x + y):
                m = y / (x + y)
                ans = (x * 100 + y, y)

print(*ans)

Submission status: Wrong Answer

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

X = []
Y = []
for i in range(F):
    for j in range(F):
        x = A * i + B * j
        if x * 100 < F:
            X.append(x)
        y = C * i + D * j
        if y < F:
            Y.append(y)
m = 0
ans = []
for x in X:
    for y in Y:
        if x * 100 + y < F and x * E > y:
            if m < y / (x + y):
                m = y / (x + y)
                ans = (x * 100 + y, y)

print(*ans)

Submission status: Wrong Answer

Solution code:
import math
a, b, c, d, e, f = [int(x) for x in input().split()]
threshold = e / (100 + e) * 100
max_concent = 0
max_total = 0
max_suger = 0
max_suger_try = int(threshold/100*f//c)
for i in range(31):
    for j in range(31):
        for k in range(max_suger_try):
            for l in range(max_suger_try):
                water = a * i * 100 + b * j * 100
                suger = c * k + d * l   
                if water == 0:
                    break
                concentration = suger / (water + suger) * 100
                if (water + suger > f or concentration > threshold) :
                    break
                else:
                    if concentration > max_concent:
                        max_concent = concentration
                        max_total = water + suger
                        max_suger = suger
print("{} {}".format(max_total, max_suger))

Submission status: Wrong Answer

Solution code:
import math
a, b, c, d, e, f = [int(x) for x in input().split()]
threshold = e / (100 + e) * 100
max_concent = 0
max_total = 0
max_suger = 0
max_suger_try = math.ceil(threshold * f / 100 / c) + 1
for i in range(31):
    for j in range(31):
        for k in range(max_suger_try):
            for l in range(max_suger_try):
                water = a * i * 100 + b * j * 100
                suger = c * k + d * l   
                if water == 0:
                    break
                concentration = suger / (water + suger) * 100
                if (water + suger > f or concentration > threshold) :
                    break
                else:
                    if concentration > max_concent:
                        max_concent = concentration
                        max_total = water + suger
                        max_suger = suger
print("{} {}".format(max_total, max_suger))

Submission status: Wrong Answer

Solution code:
import math
a, b, c, d, e, f = [int(x) for x in input().split()]
threshold = e / (100 + e) * 100
max_concent = 0
max_total = 0
max_suger = 0
max_suger_try = math.ceil(threshold * f / 100 / c)
for i in range(31):
    for j in range(31):
        for k in range(max_suger_try):
            for l in range(max_suger_try):
                water = a * i * 100 + b * j * 100
                suger = c * k + d * l   
                if water == 0:
                    break
                concentration = suger / (water + suger) * 100
                if (water + suger > f or concentration > threshold) :
                    break
                else:
                    if concentration > max_concent:
                        max_concent = concentration
                        max_total = water + suger
                        max_suger = suger
print("{} {}".format(max_total, max_suger))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=F//100
w,s=100*A,0
for x in range(X,0,-1):
    a,b=0,0
    while A*a<=x:
        b=(x-A*a)%B
        if b==0:
            break
        a+=1
    if b==0:
        b=(x-A*a)//B
        maxs=F-100*(A*a+B*b)
        c,d=0,0
        cc=0
        while C*cc<=maxs:
            dd=(maxs-C*cc)//D
            if C*cc+D*dd>C*c+D*d:
                c,d=cc,dd
            cc+=1
        if s/w<(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            s,w=C*c+D*d,100*(A*a+B*b)+C*c+D*d
print(w,s)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=F//100
w,s=100*A,0
for x in range(X,0,-1):
    a,b=0,0
    while A*a<=x:
        b=(x-A*a)%B
        if b==0:
            break
        a+=1
    if b==0:
        b=(x-A*a)//B
        c,d=0,0
        cc=0
        while C*cc<=E*x:
            dd=(E*x-C*cc)//D
            if C*cc+D*dd>C*c+D*d and 100*(A*a+B*b)+C*cc+D*dd<=F:
                c,d=cc,dd
            cc+=1
        if s/w<(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            s,w=C*c+D*d,100*(A*a+B*b)+C*c+D*d
print(w,s)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=F//100
w,s=1,0
for x in range(X,0,-1):
    a,b=0,0
    while A*a<=x:
        b=(x-A*a)%B
        if b==0:
            break
        a+=1
    if b==0:
        b=(x-A*a)//B
        c,d=0,0
        cc=0
        while C*cc<=E*x:
            dd=(E*x-C*cc)//D
            if C*cc+D*dd>C*c+D*d and 100*(A*a+B*b)+C*cc+D*dd<=F:
                c,d=cc,dd
            cc+=1
        if s/w<(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            s,w=C*c+D*d,100*(A*a+B*b)+C*c+D*d
print(w,s)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
X=F//(100+E)
w,s=1,0
for x in range(X,0,-1):
    a,b=0,0
    while A*a<=x:
        b=(x-A*a)%B
        if b==0:
            break
        a+=1
    if b==0:
        b=(x-A*a)//B
        c,d=0,0
        cc=0
        while C*cc<=E*x:
            dd=(E*x-C*cc)//D
            if C*cc+D*dd>C*c+D*d:
                c,d=cc,dd
            cc+=1
        if s/w<(C*c+D*d)/(100*(A*a+B*b)+C*c+D*d):
            s,w=C*c+D*d,100*(A*a+B*b)+C*c+D*d
print(w,s)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
x=set()
for i in range(0,f+1,a):
    for j in range(0,f+1,b):
        if 0<(i+j)<=f:
            x.add(i+j)
y=set()
for i in range(0,f+1,c):
    for j in range(0,f+1,d):
        if 0<(i+j)<=f:
            y.add(i+j)

ans=[]
for n in x:
    for m in y:
        if n+m>f:
            continue
        if n*e<m*100:
            continue
        ans.append([n+m,m,m/n])
if not ans:
    print(0,0)
    exit()
ans.sort(key=lambda x:x[2], reverse=True)

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

Submission status: Wrong Answer

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

w = {0}
s = {0}

for i in range(f+1):
    for j in range(f+1):
        x = 100 * (a * i + b * j)
        if x <= f:
            w.add(x)

for i in range(f+1):
    for j in range(f+1):
        y = c * i + d * j
        if y <= f:
            s.add(y)

s_list = list(s)
s_list.sort()
w_list = list(w)
w_list.sort()


c_ans = 0
s_ans = 0
w_ans = 0

for i in range(1, len(w_list)):
    for j in range(1, len(s_list)):
        z = s_list[j] * 100 / w_list[i]
        sum = w_list[i] + s_list[j]
        if z <=e and z >= c_ans and sum <= f:
            c_ans = z
            w_ans = w_list[i]
            s_ans = s_list[j]

print(w_ans + s_ans, s_ans)

Submission status: Wrong Answer

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

w = {0}
s = {0}

for i in range(f+1):
    for j in range(f+1):
        x = 100 * (a * i + b * j)
        if x <= f:
            w.add(x)

for i in range(f+1):
    for j in range(f+1):
        y = c * i + d * j
        if y <= f:
            s.add(y)

s_list = list(s)
s_list.sort()
w_list = list(w)
w_list.sort()


c_ans = 0
s_ans = 0
w_ans = 0

for i in range(1, len(w_list)):
    for j in range(1, len(s_list)):
        z = s_list[j] * 100 / w_list[i]
        sum = w_list[i] + s_list[j]
        if z <=e and z >= c_ans and sum <= f:
            c_ans = z
            w_ans = w_list[i]
            s_ans = s_list[j]

print(str(w_ans + s_ans) + " " + str(s_ans))

Submission status: Wrong Answer

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

w = {0}
s = {0}

for i in range(f+1):
    for j in range(f+1):
        x = 100 * (a * i + b * j)
        if x <= f:
            w.add(x)

for i in range(f+1):
    for j in range(f+1):
        y = c * i + d * j
        if y <= f:
            s.add(y)

s_list = list(s)
s_list.sort()
w_list = list(w)
w_list.sort()


c_ans = 0
s_ans = 0
w_ans = 0

for i in range(1, len(w_list)):
    for j in range(1, len(s_list)):
        z = 100 * s_list[j] / (s_list[j] + w_list[i])
        sum = w_list[i] + s_list[j]
        if z <= (100 * e / (e + 100)) and z >= c_ans and sum <= f:
            c_ans = z
            w_ans = w_list[i]
            s_ans = s_list[j]

print(str(w_ans + s_ans) + " " + str(s_ans))