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: Runtime Error

Solution code:
def 解():
    iA,iB,iC,iD,iE,iF = [int(_) for _ in input().split()]
    #とりあえず全検索
    d = {}
    iMaxA = iF // 100*iA
    for i in range(iMaxA+1):
        iMaxB = (iF - 100*iA*i) // iB
        for j in range(iMaxB + 1):
            if i==0 and j==0:
                continue
            iAB = 100*iA*i + 100*iB*j
            iUlim = iAB * iE // 100
            if iAB + iUlim > iF :
                continue
            iMaxC = iUlim //iC
            for k in range(iMaxC+1):
                l = (iUlim - iC*k ) //iD
                iCD = iC*k +iD*l
                #if iCD > iF-iAB:
                #   continue
                if iUlim -iCD == 0:
                    print(iAB +iCD,iCD)
                    exit()
                else:
                    iKey = iUlim-iCD
                    if not iKey in d:
                        d[iKey] = (iAB +iCD,iCD)
    iMin = min(d.keys())
    print(" ".join(map(str,d[iMin])))
解()

Submission status: Runtime Error

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

tmp_c = 0

for a in range(0, F+1, A*100):
    for b in range(0, F+1, B*100):
        for c in range(0, int(F/100 * E) + 1, C):
            for d in range(0, int(F/100 * E) + 1, D):
                w = a + b
                s = c + d
                if s == 0:
                    concentration = 0
                else:
                    concentration = s / (w + s)
                    
                if concentration <= E / (100 + E) and concentration > tmp_c and w + s <= F:
                    ans_sw = s+w
                    ans_s = s
                    tmp_c = concentration

print(ans_sw, ans_s)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import itertools
l = ['a', 'b', 'c', 'd']
l2 = ['a', 'b', 'c', 'd']
c = itertools.combinations(l, 2)
p = itertools.product(l, l2)
p = itertools.permutations(l, 2)
ope = ['+','-']
ope_list = itertools.product(ope, repeat=3)

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

water_max = F // (E+100) * 100
suger_max = water_max * E // 100
ope1_max = water_max // (100*A)
ope3_max = suger_max // C

ope1 = [x for x in range(ope1_max+1)]
ope3 = [x for x in range(ope3_max+1)]

ans_list = []
for a,c in itertools.product(ope1, ope3):
    b = (water_max - 100*a*A) // (100*B)
    water_ans = 100*a*A + 100*b*B
    # E = (c*C + d*D) * 100 / water_ans
    # E * water_ans = (c*C + d*D) * 100
    d = (E * water_ans // 100 - c*C) // D

    if a+b > 0:
        # print(a,b,c,d)
        suger_ans = c*C + d*D
        sugwat_ans = water_ans + suger_ans
        if suger_ans * 100 // water_ans <= E:
            temp = suger_ans * 100 / sugwat_ans
            ans_list.append([temp,sugwat_ans,suger_ans])

ans_list.sort(key=lambda x:x[0])
print(ans_list[-1][1],ans_list[-1][2])

Submission status: Runtime Error

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

W = set()
for a in range(0, F+1, 100 * A):
    for b in range(0, F - a+1, 100 * B):
        W.add(a + b)

S = set()
for c in range(0, F+1, C):
    for d in range(0, F - c+1, D):
        S.add(c + d)

ans = None
mx = 0
for w in W:
    for s in S:
        if 0 < w + s <= F and s <= w * E // 100:
            if mx < s/(w+s):
                ans = w+s, s
                mx = s/(w+s)
print(ans[0], ans[1])

Submission status: Runtime Error

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

water_set = set()
sugar_set = set()

for ai in range(3000 // (100 * A) + 1):
    for bi in range(3000 // (100 * B) + 1):
        if ai * 100 * A + bi * 100 * B <= 3000:
            water_set.add(ai * 100 * A + bi * 100 * B)

for ci in range(3000 // C + 1):
    for di in range(3000 // D + 1):
        if ci * C + di * D <= 3000:
            sugar_set.add(ci * C + di * D)

water_list = sorted(list(water_set))
sugar_list = sorted(list(sugar_set))

cons = 0
water_ans = 0
sugar_ans = 0
for water in water_list:
    for sugar in sugar_list:
        if water + sugar <= F and sugar <= E * water:
            if 100 * water / (water + sugar) > cons:
                cons = 100 * water / (water + sugar)
                water_ans = water
                sugar_ans = sugar

print(sugar_ans, water_ans)

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = map(int, input().split())
num = None
rec = 0
for a in range(101):
    for b in range(101):
        if a * A * 100 + b * B * 100 > F:
            break
        for c in range(100):
            if a * A * 100 + b * B * 100 + c * C > F:
                break
            for d in range(100):
                q = a * A * 100 + b * B * 100
                p = C * c + D * d
                if p > E * (a * A + b * B):
                    continue
                if p + q == 0:
                    continue
                if p + q <= F:
                    if rec < 100 * p / (p + q):
                        rec = 100 * p / (p + q)
                        num = (p + q, p)
                else:
                    break
print(num[0], num[1])

Submission status: Runtime Error

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

m=int(f*(e/100))
for i in range(0,m+1,c):
  for j in range(0,m-i+1,d):
     y.add(i+j)
x.remove(0) 
z=[-1]
ans=[]
for i in x:
  for j in y:
    if i+j<=f and j*100/(i+j)<=e*100/(100+e):
      if j*100/(i+j)>max(z):
        z.append(j*100/(i+j))
        ans.append([i+j,j])
        
print(ans[-1][0],ans[-1][1])

Submission status: Runtime Error

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

m=int(f*(e/100))
for i in range(0,m+1,c):
  for j in range(0,m-i+1,d):
     y.add(i+j)
x.remove(0) 
z=[-1]
ans=[]
for i in x:
  for j in y:
    if i+j<=f and j*100/(i+j)<=e*100/(100+e):
      if j*100/(i+j)>max(z):
        z.append(j*100/(i+j))
        ans.append([i+j,j])
        
print(ans[-1][0],ans[-1][1])
print(x)

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[-1]
ans=[]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w):
    for k in range(m//c):
      flag=0
      for n in range((m-k*c)//d,0,-1):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[[0,0]]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w+1):
    for k in range(0,m//c+1,c):
      for n in range(0,(m-k*c)//d+1,d):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w+1):
    for k in range(m//c+1):
      flag=0
      for n in range((m-k*c)//d+1,0,-1):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[0]
ans=[]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w):
    for k in range(m//c):
      flag=0
      for n in range((m-k*c)//d,0,-1):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

Submission status: Runtime Error

Solution code:
import strutils

proc input: string =
  while true:
    let tmp = readChar stdin
    if not isSpace tmp:
      safeAdd result, tmp
    elif tmp != '\r': break

let
  A, B, C, D, E, F = parseInt input()
var
  best = -1.0
  ws, sg = 0

for a in countup(0, F, 100 * A):
  for b in countup(0, F - a, 100 * B):
    let
      w = a + b
      m = min(F - w, w * E div 100)

    if w == 0: continue
    for c in countup(0, m, C):
      for d in countup(0, m - c, D):
        let s = c + d
        if best < s / (w + s):
          best = s / (w + s)
          ws = w + s
          sg = s

echo ws, " ", sg

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F=map(int, input().split())
a=[[0,0]]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F=map(int, input().split())
a=[]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y/(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F=map(int, input().split())
a=[]
for i in range(101):
    for j in range(101):
        for k in range(101):
            for l in range(101):
                x=100*A*i+100*B*j
                y=C*k+D*l
                if x+y>F or x==0 or y==0:
                    break
                if 100*y//(x+y)<=(E*100)/(100+E):
                    a.append([str(x+y),str(y)])
print(' '.join(sorted(a, key=lambda x: (100*int(x[1]))/int(x[0]) if int(x[0])!=0 else 0)[-1]))

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F = map(int,input().split())
smax =int(F*E/(100+E))
wmax =F-smax
temp = []
for a in range(wmax//(A*100)+1):
    for b in range(wmax // (B*100)+1):
        for c in range(smax // (C)+1):
            for d in range(smax // (D)+1):
                if a == 0 and b== 0:
                    pass
                elif (c*C+d*D)/(100*a*A+100*b*B+c*C+d*D)<=E/(100+E) and 100*a*A+100*b*B <=wmax and c*C+d*D <=smax:
                    temp.append([100*a*A+100*b*B+c*C+d*D,c*C+d*D,(c*C+d*D)/(100*a*A+100*b*B+c*C+d*D)])
a = sorted(temp,key= lambda x:x[2],reverse=True)
print(str(a[0][0])+' '+str(a[0][1]))

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F = map(int,input().split())
smax =int(F*E/(100+E))
wmax =F-smax
temp = []
for a in range(wmax//min(A*100,B*100)+1):
    for b in range(wmax // min(A*100, B*100)+1):
        for c in range(smax // min(C, D)+1):
            for d in range(smax // min(C, D)+1):
                if a == 0 and b== 0:
                    pass
                elif (c*C+d*D)/(100*a*A+100*b*B)<=E/(100+E) and 100*a*A+100*b*B <=wmax and c*C+d*D <=smax:
                    temp.append([100*a*A+100*b*B,c*C+d*D])
maxn =[]
for i in temp:
    maxn.append(i[1]/i[0])
print(' '.join(map(str,temp[maxn.index(max(maxn))])))

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = list(map(int, input().split()))
num_A = int(F / A / 100) + 1
num_B = int(F / B / 100) + 1
def opt_s(x, y, S):
    num_x = int(S / x) + 1
    num_y = int(S / y) + 1
    count = 0
    for p in range(num_x):
        for q in range(num_y):
            if x * p + y * q > S:
                break
            else:
                count = max(count, x * p + y * q)
    return count
sugar = 0
for i in range(num_A):
    for j in range(num_B):
        if i * A * 100 + j * B * 100 > F:
            break
        else:
            S_max = min(F - i * A * 100 - j * B * 100, E * (i * A + j * B))
            result = opt_s(C, D, S_max)
            if  result > sugar:
                sugar = result
                water = (i * A + j * B) * 100 + sugar
print(water, sugar)

Submission status: Runtime Error

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

ab_list = set()

for i in range(0,f//100+1,a):
    for j in range(0, f//100-i+1, b):
        ab_list.add(100*(i+j))

ab_max = max(ab_list)

sug_max = int(ab_max*(e/100))

cd_list = set()

for i in range(0,sug_max+1, c):
    for j in range(0, sug_max-i+1, d):
        cd_list.add(i+j)


water = list(ab_list)
water.sort()

sugar = list(cd_list)
sugar.sort()

s = 0
ans = [0,0]
max_noudo = 0
for w in water[1:]:
    while (sugar[s+1] <= int(w*e/100)):
        if (s+1) >= len(sugar)-1:
            break
        s += 1
        
    noudo = sugar[s]/(w+sugar[s])
    if noudo > max_noudo:
        max_noudo = noudo
        ans = [w+sugar[s], sugar[s]]
        
print(*ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 05:19:32 2018

@author: Yuki
"""

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


# 全組み合わせを試して、
# 条件の篩にかける


res = 0
for water_i in range(1, 4):
    for sugar_i in range(1, 4):
        water_bin = bin(water_i)[2:].zfill(2)
        sugar_bin = bin(sugar_i)[2:].zfill(2)
        if water_bin == '01':
            water = B * 100
        elif water_bin == '10':
            water = A * 100
        else:
            water = (A + B) * 100
        if sugar_bin == '01':
            sugar = C
        elif sugar_bin == '10':
            sugar = D
        else:
            sugar = C + D
        if (water + sugar) > F:
            break
        if water // 100 * E < sugar:
            break
        if res < (sugar / water * 100):
            res = sugar / water * 100
            ans = [water+sugar, sugar]
            
print(ans[0], ans[1])

Submission status: Runtime Error

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

import functools

@functools.lru_cache(maxsize=None)
def calc_strength(sugar, water):
    if water == 0: return -1
    return sugar * 100 / (sugar + water)

@functools.lru_cache(maxsize=None)
def f(strength, sugar, water):
    cand = []
    for x in ((C, 0), (D, 0), (0, 100*A), (0, 100*B)):
        s, w = sugar + x[0], water + x[1]
        if s + w <= F and s * 100 <= w * E:
            cand.append(f(calc_strength(s, w), s, w))
    if cand: return sorted(cand, reverse=True)[0]
    return (strength, sugar + water, sugar)
    
print(f(-1, 0, 0)[1:])

Submission status: Runtime Error

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


def f(x, y):
    max_i = F // x
    max_j = F // y
    arr = []
    for i in range(max_i + 1):
        for j in range(max_j + 1):
            a = x * i + y * j
            if 0 < a < F:
                arr.append(a)
    return sorted(list(set(arr)))


water = f(100 * A, 100 * B)
sugar = f(C, D)

ans = []
for w in water:
    for s in sugar:
        if w + s <= F and s / w * 100 <= E:
            ans.append((w + s, s))
ans = sorted(ans, key=lambda x: x[1] / x[0], reverse=True)
print(ans[0][0], ans[0][1])

Submission status: Runtime Error

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

AonlyC = (A*E) // C
AonlyD = (A*E) // D
BonlyC = (B*E) // C
BonlyD = (B*E) // D
ACandD = []
BCandD = []

for CA in range(AonlyC+1):
  for DA in range(AonlyD+1):
    if CA*C + DA*D <= A*E:
      if 100*A + CA*C + DA*D <= F:
        ACandD.append((CA * C) + (DA * D))
for CB in range(BonlyC+1):
  for DB in range(BonlyD+1):
    if CB*C + DB*D <= B*E:
      if 100*B + CB*C + DB*D <= F:
        BCandD.append((CB * C) + (DB * D))

ACandD.sort(reverse=True)
BCandD.sort(reverse=True)

flag = 0
if ACandD[0] <= BCandD[0]:
  result = BCandD[0]
  flag = 1
else:
  result = ACandD[0]
  flag = 2
  
if flag == 1:
  mid = 100*B + result
  out = str(mid) + " " + str(result)
  print(out)
else:
  mid = 100*A + result
  out = str(mid) + " " + str(result)
  print(out)

Submission status: Runtime Error

Solution code:

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

    # 100gあたりE [g]溶ける
    # ビーカーにF [g]いれられる
    # 濃度は100*砂糖 / (水＋砂糖)


    mizu=[]
    sato=[]


    x = int(f/100/a) +1
    y = int(f/100/b) +1

    for i in range(x):
        for j in range(y):
            mizu.append(i*100*a + j*100*b)

    mizu = [i for i in mizu if i <= f]
    mizu = list(set(mizu))
    mizu.sort()

    tokeru = int(f/100) * e
    x = int(tokeru / c) +1
    y = int(tokeru / d) +1

    for i in range(x):
        for j in range(y):
            sato.append(i*c + j*d)

    sato = [i for i in sato if i < tokeru]
    sato = list(set(sato))
    sato.sort()
    sato.remove(0)
    mizu.remove(0)

    tmp =0

    for i in mizu:
        for j in sato:
            if i + j <= f:
                if int(i/100)*e >=j:
                    if tmp <= (100*j) / (i + j):
                        tmp = (100*j) / (i + j)
                        ans = str(i+j) + " " + str(j)

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Runtime Error

Solution code:

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

    # 100gあたりE [g]溶ける
    # ビーカーにF [g]いれられる
    # 濃度は100*砂糖 / (水＋砂糖)


    mizu=[]
    sato=[]


    x = int(f/100/a) +1
    y = int(f/100/b) +1

    for i in range(x):
        for j in range(y):
            mizu.append(i*100*a + j*100*b)

    mizu = [i for i in mizu if i <= f]
    mizu = list(set(mizu))
    mizu.sort()

    tokeru = int(f/100) * e
    x = int(tokeru / c) +1
    y = int(tokeru / d) +1

    for i in range(x):
        for j in range(y):
            sato.append(i*c + j*d)

    sato = [i for i in sato if i < tokeru]
    sato = list(set(sato))
    sato.sort()
    sato.remove(0)
    mizu.remove(0)

    tmp =0

    for i in mizu:
        for j in sato:
            if i + j <= f:
                if int(i/100)*e >=j:
                    if tmp <= (100*j) / (i + j):
                        tmp = (100*j) / (i + j)
                        ans = [i+j,j]

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Runtime Error

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

    mizu=[]
    sato=[]

    x = int(f/100//a) +1
    y = int(f/100//b) +1

    for i in range(x):
        for j in range(y):
            mizu.append(i*100*a+j*100*b)

    mizu = [i for i in mizu if i <= f]
    mizu = list(set(mizu))
    mizu.sort()

    tokeru = int(f/100) * e
    x = tokeru // c +1
    y = tokeru // d +1

    for i in range(x):
        for j in range(y):
            sato.append(i*c + j*d)

    sato = [i for i in sato if i < tokeru]
    sato = list(set(sato))
    sato.sort()
    sato.remove(0)
    mizu.remove(0)

    tmp =0

    for i in mizu:
        for j in sato:
            if i + j <= f:
                if i//100*e >=j:
                    if tmp <= (100*j) / (i + j):
                        tmp = (100*j) / (i + j)
                        ans = [i+j,j]

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Runtime Error

Solution code:

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

    # 100gあたりE [g]溶ける
    # ビーカーにF [g]いれられる
    # 濃度は100*砂糖 / (水＋砂糖)


    mizu=[]
    sato=[]
    noudo=[]


    x = int(f/100//a) +1
    y = int(f/100//b) +1

    for i in range(x):
        for j in range(y):
            mizu.append(i*100*a+j*100*b)

    mizu = [i for i in mizu if i <= f]
    mizu = list(set(mizu))
    mizu.sort()

    tokeru = int(f/100) * e
    x = tokeru // c +1
    y = tokeru // d +1

    for i in range(x):
        for j in range(y):
            sato.append(i*c + j*d)

    sato = [i for i in sato if i < tokeru]
    sato = list(set(sato))
    sato.sort()
    sato.remove(0)
    mizu.remove(0)

    tmp =0

    for i in mizu:
        for j in sato:
            if i + j <= f:
                if i//100*e >=j:
                    if tmp <= (100*j) / (i + j):
                        tmp = (100*j) / (i + j)
                        ans = [i+j,j]

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Runtime Error

Solution code:

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

    # 100gあたりE [g]溶ける
    # ビーカーにF [g]いれられる
    # 濃度は100*砂糖 / (水＋砂糖)


    mizu=[]
    sato=[]
    noudo=[]


    x = int(f/100//a) +1
    y = int(f/100//b) +1

    for i in range(x):
        for j in range(y):
            mizu.append(i*100*a+j*100*b)

    mizu = [i for i in mizu if i <= f]
    mizu = list(set(mizu))
    mizu.sort()

    tokeru = int(f/100) * e
    x = tokeru // c +1
    y = tokeru // d +1

    for i in range(x):
        for j in range(y):
            sato.append(i*c + j*d)

    sato = [i for i in sato if i < tokeru]
    sato = list(set(sato))
    sato.sort()
    sato.remove(0)
    mizu.remove(0)

    tmp =0

    for i in mizu:
        for j in sato:
            if i + j <= f and i//100*e >= j :
                if tmp <= (100*j) / (i + j):
                    ans = [i+j,j]

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Runtime Error

Solution code:

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

    # 100gあたりE [g]溶ける
    # ビーカーにF [g]いれられる
    # 濃度は100*砂糖 / (水＋砂糖)


    mizu=[]
    sato=[]
    noudo=[]


    x = int(f/100//a) +1
    y = int(f/100//b) +1

    for i in range(x):
        for j in range(y):
            mizu.append(i*100*a+j*100*b)

    mizu = [i for i in mizu if i <= f]
    mizu = list(set(mizu))
    mizu.sort()

    tokeru = int(f/100) * e
    x = tokeru // c +1
    y = tokeru // d +1

    for i in range(x):
        for j in range(y):
            sato.append(i*c + j*d)

    sato = [i for i in sato if i < tokeru]
    sato = list(set(sato))
    sato.sort()
    sato.remove(0)
    mizu.remove(0)

    tmp =0

    for i in mizu:
        for j in sato:
            if i + j <= f and i//100*e >= j :
                if tmp <= (100*j) / (i + j):
                    print((100*j) / (i + j))
                    ans = [i+j,j]

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F= map(int, input().split())
res_dict = {}
x_list = []
for i in range(F//A + 1):
    for j in range((F-100*A*i)//B + 1):
        x = 100 * (i*A + j*B)
        if x <=F:
            x_list.append(x)
x_uniq = list(set(x_list))
for x in x_uniq:
    for i in range((F-x)//C + 1):
        for j in range((F-x-C*j)//D + 1):
            y = j*C + k*D
            if x+y <= F and x + y != 0 and x != 0 and ((y/(x+y) <=(E/(100+E)))):
                res_dict[x] = y
res_dict2 = {}
for i in res_dict:
    res_dict2[res_dict[i]/i] = i
print("{0} {1}".format(int(((1 + max(res_dict2))*res_dict2[max(res_dict2)])),int(max(res_dict2)*res_dict2[max(res_dict2)])))

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F= map(int, input().split())
res_dict = {}
x_list = []
for i in range(F//A + 1):
    for j in range((F-100*A*i)//B + 1):
        x = 100 * (i*A + j*B)
        if x <=F:
            x_list.append(x)
x_uniq = list(set(x_list))
for x in x_uniq:
    for i in range((F-x)//C + 1):
        for j in range((F-x-C*j)//D + 1):
            y = j*C + k*D
            if x+y <= F and x + y != 0 and ((y/(x+y)*100 <=E)):
                res_dict[x] = y
res_dict2 = {}
for i in res_dict:
    res_dict2[res_dict[i]/i] = i
print("{0} {1}".format(int(((1 + max(res_dict2))*res_dict2[max(res_dict2)])),int(max(res_dict2)*res_dict2[max(res_dict2)])))

Submission status: Runtime Error

Solution code:
import math

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

max_b = math.floor(F/(100*B))

W=[]

for i in range(max_b):
    water=i*100*B
    while water<=F:
        if water!=0:
            W.append(water)
        water+=A*100

W=list(set(W))
W.sort()

ans=[0,0,0]

for i in W:
    max_s=(i*E)//100
    if max_s+i>F:
        max_s=F-i
    max_num=math.floor(max_s/D)
    max_cd=max_num*D
    for j in range(max_num,-1,-1):  
        max_c=math.floor(max_s-j*D)/C)
        if max_cd<max_c*C+j*D:
            max_cd=max_c*C+j*D
    no=max_cd/(max_cd+i)
    if no>ans[0] and max_cd+i <=F:
        ans=[no,max_cd+i,max_cd]

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

Submission status: Runtime Error

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

waters = set()
for w1 in range(0,F+1,B):
    if w1*100 > F: break
    for w2 in range(0,F+1,A):
        w = (w1+w2)*100
        if w > F: break
        if w==0: continue
        waters.add(w)

sugars = set()
for s1 in range(0,F+1,D):
    if s1 > F: break
    for s2 in range(0,F+1,C):
        s = s1+s2
        if s > F: break
        sugars.add(s)

ans_r = 0
ans_s = ans_w = None
for w in sorted(waters):
    if w > F: break
    for s in sorted(sugars):
        if w+s > F: break
        if s*100 > w*E: break
        r = 100*s/(s+w)
        if r > ans_r:
            ans_r = r
            ans_w = w
            ans_s = s
print(ans_s+ans_w, ans_s)

Submission status: Runtime Error

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

waters = set()
for w1 in range(0,F+1,B):
    if w1*100 > F: break
    for w2 in range(0,F+1,A):
        w = (w1+w2)*100
        if w > F: break
        waters.add(w)

sugars = set()
for s1 in range(0,F+1,D):
    if s1 > F: break
    for s2 in range(0,F+1,C):
        s = s1+s2
        if s > F: break
        if s==0: continue
        sugars.add(s)

ans_r = 0
ans_s = ans_w = None
for w in sorted(waters):
    if w > F: break
    for s in sorted(sugars):
        if w+s > F: break
        if s*100 > w*E: break
        r = 100*s/(s+w)
        if r > ans_r:
            ans_r = r
            ans_w = w
            ans_s = s
print(ans_s+ans_w, ans_s)

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F=map(int,input().split())
#100*A*i + 200*B*j == x
#C*i + D*j == y
xs = []
ys = []
def dens(x,y):
    if x+y==0:
        return(-1)
    else:
        return(y/(x+y))
for i in range(31):
    for j in range(16):
        if 100*A*i + 200*B*j <= F:
            xs.append(100*A*i + 200*B*j)
for i in range(3001):
    for j in range(1501):
        if C*i + D*j <= F:
            ys.append(C*i + D*j)
density = 0
for x in xs:
    for y in ys:
        if x+y > F or 100*y > E*x:
            continue
        nd = dens(x,y)
        if nd > density:
            density = nd
            sugar = y
            water = x
            #print([sugar,water,density])
print(str(water+sugar) + " " + str(sugar))

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
water=[]
suguar=[]
for i in range((f+1)//100):
    for j in range((f+1)//100):
        x=100*i*a+100*j*b
        if 1<=x<=f:
            water.append(x)
for i in range(f+1):
    for j in range(f+1):
        y=c*i+d*j
        if y<=f:
            suguar.append(y)
ans=0
for i in water:
    for j in suguar:
        total=i+j
        if total<=f:
            if j<=i//100*e:
                con=100*j/(i+j)
                if ans<con:
                    ans=con
                    ans_2=total
                    ans_3=j
print(ans_2,ans_3)

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F=map(int,input().split())
threshold=E/(100+E)
water=[]
for i in range (int(F/(A*100)+1)):
    for j in range (int(F/(B*100)+1)):
        water.append(A*100*i+B*100*j)
sugar=[]
for k in range (int(F/(C)+1)):
    for l in range (int(F/(D)+1)):
        sugar.append(C*k+D*l)
water=list(set(water))
sugar=list(set(sugar))
output=0
for i in range (len(water)):
    for j in range (len(sugar)):
        try:
            if threshold>=(int(sugar[j])/((int(water[i])+int(sugar[j])))) and (int(sugar[j])/((int(water[i])+int(sugar[j]))))>output and water[i]+sugar[j]<F:
                output=(int(sugar[j])/((int(water[i])+int(sugar[j]))))
                water_result=water[i]
                sugar_result=sugar[j]
        except ZeroDivisionError:
            continue
print(str(water_result+sugar_result)+' '+str(sugar_result))