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())
w = []
for i in range(f//100+1):
	for j in range(f//100+1):
		x = a*i*100+b*j*100
		if x > 0 and x <= f:
			w.append(x)
w.sort()
s = []
for i in range(f//c+1):
	for j in range(f//d+1):
		if  c*i+(c*i)*e/100 + d*j+(d*j)*e/100 <= f:
			s.append(c*i + d*j)
s.sort(reverse=True)
c = -1.0
for i in w:
	for j in s:
		if i+j <= f and j <= i*e/100:
			if c < 100*j/(i+j):
				c = 100*j/(i+j)
				print(i+j,j)
				exit()

Submission status: Wrong Answer

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

# 作れるか判定
def check(goal,ac,bd):
    flag = 0
    for x in range(int(goal//ac)+1):
            if (goal-ac*x)%bd == 0 : flag = 1 ; break
    return flag

# 水W、砂糖Sをまわす
anss = []
for w in range(100,f+1,100):
    for s in range(1,f-w+1):
        if check(w,100*a,100*b) and check(s,c,d) and s<=((w*e)/100):
            conc = 100*s/(w+s) # concentration
            anss.append([conc,w,s])

anss.sort(reverse=1)
if anss: w,s = anss[0][1],anss[0][2]
else: w,s = 0,0
print(w+s,s)

Submission status: Wrong Answer

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

# 作れるか判定
def check(goal,ac,bd):
    flag = 0
    for x in range(int(goal//ac)+1):
            if (goal-ac*x)%bd == 0 : flag = 1 ; break
    return flag

# 水W、砂糖Sをまわす
anss = []
for w in range(100,f+1,100):
    for s in range(1,f-w+1):
        if check(w,100*a,100*b) and check(s,c,d) and s<=((w*e)/100):
            conc = 100*s/(w+s) # concentration
            anss.append([conc,w,s])

anss.sort(reverse=1)
print(anss)
if anss: w,s = anss[0][1],anss[0][2]
else: w,s = 0,0
print(w+s,s)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

sugar=[]
g=gcd(C,D)
for i in range(0,3000):
    if i>=C*D and i%g==0:
        sugar.append(i)

for i in range(0,D):
    for j in range(0,C):
        if C*D>i*C+j*D:
            sugar.append(i*C+j*D)

sugar.sort()

ans=(0,1)
for i in range(F//(100*A)+1):
    for j in range(F//(100*B)+1):
        if F>100*A*i+100*B*j:
            x=F-(100*A*i+100*B*j)
            y=(A*i+B*j)*E
            sugarupper=min(x,y)

            start=0
            end=len(sugar)
            while end-start>1:
                test=(end+start)//2
                if sugarupper>=sugar[test]:
                    start=test
                else:
                    end=test

            if sugarupper>=sugar[end]:
                s=sugar[end]
            else:
                s=sugar[start]

            m,n=ans
            if n*s>m*(100*A*i+100*B*j+s):
                ans=(s,100*A*i+100*B*j+s)

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

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int, input().split())
water, suger = 0,0
dense = 0
waters = set()
sugers = set()
for i in range(0,31,a):
  for j in range(i,31,b):
    waters.add(j*100)
for i in range(0,f//2+1,c):
  for j in range(i,f//2+1,d):
    sugers.add(j)
waters = sorted(list(waters))
sugers = sorted(list(sugers))
for w in waters:
  for s in sugers:
    sw = w+s
    if sw > f or s > (w//100)*e or sw == 0:
      continue
    if s / (s+w) > dense:
      water,suger = sw,s
      dense = s/ (s+w)
print(water,suger)

Submission status: Wrong Answer

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

if a*100==f:
  print(f,0)
  exit()

for x in range(0,31):
  for y in range(0,31):
    if x==y==0:
      continue
    water=100*(a*x + b*y)
    for z in range(0,f-water+1):
      for w in range(0,f-water+1):
        if z==w==0:
          continue
        sugar=c*z + d*w
        beaker=sugar+water
        tmp_con=(sugar*100)/beaker
        if beaker>f:break
        if sugar<=(a*x + b*y)*e and tmp_con>con:
          ans_beaker=beaker
          ans_sugar=sugar
          con=tmp_con
       
print(ans_beaker,ans_sugar)

Submission status: Wrong Answer

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

if a*100==f:
  print(a,0)
  exit()

for x in range(0,31):
  for y in range(0,31):
    if x==y==0:
      continue
    water=100*(a*x + b*y)
    for z in range(0,f-water+1):
      for w in range(0,f-water+1):
        if z==w==0:
          continue
        sugar=c*z + d*w
        beaker=sugar+water
        tmp_con=(sugar*100)/beaker
        if beaker>f:break
        if sugar<=(a*x + b*y)*e and tmp_con>con:
          ans_beaker=beaker
          ans_sugar=sugar
          con=tmp_con
       
print(ans_beaker,ans_sugar)

Submission status: Wrong Answer

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

for x in range(0,31):
  for y in range(0,31):
    if x==y==0:
      continue
    water=100*(a*x + b*y)
    for z in range(0,f+1):
      for w in range(0,f+1):
        if z==w==0:
          continue
        sugar=c*z + d*w
        beaker=sugar+water
        tmp_con=(sugar*100)/beaker
        if beaker>f:break
        if sugar<=(a*x + b*y)*e and tmp_con>con:
          ans_beaker=beaker
          ans_sugar=sugar
          con=tmp_con
       
print(ans_beaker,ans_sugar)

Submission status: Wrong Answer

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

for x in range(0,31):
  for y in range(0,31):
    if x==y==0:
      continue
    water=100*(a*x + b*y)
    for z in range(0,f-water+1):
      for w in range(0,f-water+1):
        if z==w==0:
          continue
        sugar=c*z + d*w
        beaker=sugar+water
        tmp_con=(sugar*100)/beaker
        if beaker>f:break
        if sugar<=(a*x + b*y)*e and tmp_con>con:
          ans_beaker=beaker
          ans_sugar=sugar
          con=tmp_con
       
print(ans_beaker,ans_sugar)

Submission status: Wrong Answer

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

for x in range(0,31):
  for y in range(0,31):
    if x==y==0:
      continue
    water=100*(a*x + b*y)
    for z in range(0,f-water):
      for w in range(0,f-water):
        if z==w==0:
          continue
        sugar=c*z + d*w
        beaker=sugar+water
        tmp_con=(sugar*100)/beaker
        if beaker>f:break
        if sugar<=(a*x + b*y)*e and tmp_con>con:
          ans_beaker=beaker
          ans_sugar=sugar
          con=tmp_con
       
print(ans_beaker,ans_sugar)

Submission status: Wrong Answer

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

for x in range(0,31):
  for y in range(0,31):
    if x==y==0:
      continue
    water=100*(a*x + b*y)
    for z in range(0,31):
      for w in range(0,31):
        if z==w==0:
          continue
        sugar=c*z + d*w
        beaker=sugar+water
        tmp_con=(sugar*100)/beaker
        if beaker>f:break
        if sugar<=(a*x + b*y)*e and tmp_con>con:
          ans_beaker=beaker
          ans_sugar=sugar
          con=tmp_con
       
print(ans_beaker,ans_sugar)

Submission status: Wrong Answer

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

a *= 100
b *= 100
ma = (f+a-1)//a
mb = (f+b-1)//b
mc = (f+c-1)//c
md = (f+d-1)//d
ans1 = ans2 = ans3 = 0
for i in range(ma+1):
    for j in range(mb+1):
        for k in range(mc+1):
            for m in range(md+1):
                s = a*i+b*j+c*k+d*m
                if  s> f:
                    break
                if (a*i+b*j)*e > 100*(c*k+d*m):
                    if ans3 == 0:
                        ans2 = s
                        ans3 = c*k+d*m
                    else:
                        if  ans3*s < ans2*(c*k+d*m):
                            ans2 = s
                            ans3 = c*k+d*m
print(ans2,ans3)

Submission status: Wrong Answer

Solution code:
import itertools
A, B, C, D, E, F = map(int, input().split())
U = F
water = [0]*(U+1)
water[0] = 1
for i in range(U+1):
    if water[i]:
        if i+100*A <= U:
            water[i+100*A] = 1
        if i+100*B <= U:
            water[i+100*B] = 1

water_val = [val for val in range(1, U+1) if water[val]]
print(water_val)

suger = [0]*(U+1)
suger[0] = 1
for i in range(U+1):
    if suger[i]:
        if i+C <= U:
            suger[i+C] = 1
        if i+D <= U:
            suger[i+D] = 1

suger_val = [val for val in range(U+1) if suger[val]]
max_c = -1
for w, s in itertools.product(water_val, suger_val):
    if E*w < 100*s:
        continue
    if F < w+s:
        continue

    if max_c < 100*s/(w+s):
        max_c = 100*s/(w+s)
        ans = (w+s, s)

print(*ans)

Submission status: Wrong Answer

Solution code:
import itertools
A, B, C, D, E, F = map(int, input().split())
U = F
water = [0]*(U+1)
water[0] = 1
for i in range(U+1):
    if water[i]:
        if i+100*A <= U:
            water[i+100*A] = 1
        if i+100*B <= U:
            water[i+100*B] = 1

water_val = [val for val in range(U+1) if water[val]]
suger = [0]*(U+1)
suger[0] = 1
for i in range(U+1):
    if suger[i]:
        if i+C <= U:
            suger[i+C] = 1
        if i+D <= U:
            suger[i+D] = 1

suger_val = [val for val in range(U+1) if suger[val]]
ans = (0, 0)
max_c = 0
for w, s in itertools.product(water_val, suger_val):
    if E*w < 100*s:
        continue
    if 0 < w+s <= F:
        if max_c < 100*s/(w+s):
            max_c = 100*s/(w+s)
            ans = (w+s, s)

print(*ans)

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

a, b, c, d, e, f = MAP()
a *= 100
b *= 100
per = 0
mxper = 100 * e // (100 + e)
ans = ['0', '0']
for i in range(f // a + 1):
    for j in range((f - a * i) // b + 1):
        wtr = a * i + b * j
        rmn = f - wtr
        for k in range(rmn // c + 1):
            for l in range((rmn - c * k) // d + 1):
                sgr = c * k + d * l
                if wtr + sgr == 0:
                    continue
                tmp = 100 * sgr / (wtr + sgr)
                if per < tmp <= mxper:
                    per = tmp
                    ans = [str(wtr + sgr), str(sgr)]
print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

a, b, c, d, e, f = MAP()
a *= 100
b *= 100
per = 0
ans = ['0', '0']
debug(f // a)
for i in range(f // a + 1):
    for j in range((f - a * i) // b + 1):
        wtr = a * i + b * j
        rmn = f - wtr
        for k in range(rmn // c + 1):
            for l in range((rmn - c * k) // d + 1):
                sgr = c * k + d * l
                if wtr // 100 * e < sgr:
                    continue
                if wtr + sgr > f:
                    continue
                if wtr + sgr == 0:
                    continue
                tmp = 100 * sgr / (wtr + sgr)
                if wtr // 100 * e >= sgr and tmp > per:
                    per = tmp
                    ans = [str(wtr + sgr), str(sgr)]
print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

a, b, c, d, e, f = MAP()
a *= 100
b *= 100
per = 0
ans = ['0', '0']
debug(f // a)
for i in range(f // a + 1):
    for j in range((f - a * i) // b + 1):
        wtr = a * i + b * j
        rmn = f - wtr
        for k in range(rmn // c + 1):
            for l in range((rmn - c * k) // d + 1):
                sgr = c * k + d * l
                debug(i, j, k, l, wtr, sgr)
                if wtr // 100 * e < sgr:
                    continue
                if wtr + sgr == 0:
                    continue
                tmp = 100 * sgr / (wtr + sgr)
                debug(wtr, sgr, tmp)
                if wtr // 100 * e >= sgr and tmp > per:
                    per = tmp
                    ans = [str(wtr + sgr), str(sgr)]
print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
ans=[0,A*100]
con=0
for a in range(F//100//A+1):
    for b in range(F//100//B+1):
        for c in range(F//C+1):
            for d in range(F//D+1):
                w = a*A+b*B
                s = c*C+d*D
                if s+w==0: continue
                if 100*w+s>F: break
                if s>E*w: break
                t=s/(s+100*w)
                if con<t:
                    con=t
                    ans[0]=s+100*w
                    ans[1]=s
print(*ans)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int, input().split())
ans=[-1,-1]
con=0
for a in range(F//100//A+1):
    for b in range(F//100//B+1):
        for c in range(F//C+1):
            for d in range(F//D+1):
                w = a*A+b*B
                s = c*C+d*D
                if s+w==0: continue
                if 100*w+s>F: break
                if s>E*w: break
                t=s/(s+100*w)
                if con<t:
                    con=t
                    ans[0]=s+100*w
                    ans[1]=s
print(*ans)

Submission status: Wrong Answer

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

def check_weight(a, b, c, d):
    if 100*A* a + 100*B*b + C*c + D*d <= F:
        return True
    else:
        return False

def check_conc(a, b, c, d):
    if C*c + D*d <= E * (A*a + B*b):
        return True
    else:
        return False

def check(a, b, c, d):
    if check_weight(a, b, c, d) and check_conc(a, b, c, d):
        return True
    else:
        return False

max_conc = 0
max_sugar_water = 0
max_sugar = 0

for a in range(F//(100*A) + 1):
    for b in range((F - 100*A*a)//(100*B) + 1):
        for c in range((F - 100*A*a - 100*B*b)//C + 1):
            for d in range((F - 100*A*a - 100*B*b - C*c)//D + 1):
                sugar = C*c + D*d
                water = 100*A*a + 100*B*b
                if water + sugar == 0:
                    continue
                if check(a, b, c, d) and max_conc < 100*sugar/(water + sugar):
                    max_conc = 100*sugar/(water + sugar)
                    max_sugar = sugar
                    max_sugar_water = water + sugar

print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

def check_weight(a, b, c, d):
    if 100*A* a + 100*B*b + C*c + D*d <= F:
        return True
    else:
        return False

def check_conc(a, b, c, d):
    if C*c + D*d <= E * (A*a + B*b):
        return True
    else:
        return False

def check(a, b, c, d):
    if check_weight(a, b, c, d) and check_conc(a, b, c, d):
        return True
    else:
        return False

max_conc = 0
max_sugar_water = 0
max_sugar = 0

for a in range(F//(100*A) + 1):
    for b in range(F//(100*B) + 1):
        for c in range(F//C + 1):
            for d in range(F//D + 1):
                sugar = C*c + D*d
                water = 100*A*a + 100*B*b
                if water + sugar == 0:
                    continue
                if check(a, b, c, d) and max_conc < 100*sugar/(water + sugar):
                    max_conc = 100*sugar/(water + sugar)
                    max_sugar = sugar
                    max_sugar_water = water + sugar

print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

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

ws = set()
for i in range(F+1):
    if 100*A*i > F: break
    for j in range(F+1):
        if 100*A*i + 100*B*j > F: break
        ws.add(100*A*i + 100*B*j)
ws.remove(0)
ss = set()
for i in range(F+1):
    if C*i > F: break
    for j in range(F+1):
        if C*i + D*j > F: break
        ss.add(C*i + D*j)

opt_w = 1
opt_s = 0
for w in ws:
    for s in ss:
        if w+s > F: continue
        if s*100 > w*E: continue
        if opt_s * (w+s) < s * (opt_w+opt_s):
            opt_w,opt_s = w,s
print(opt_w+opt_s, opt_s)

Submission status: Wrong Answer

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

def check_weight(a, b, c, d):
    if 100*A* a + 100*B*b + C*c + D*d <= F:
        return True
    else:
        return False

def check_conc(a, b, c, d):
    if C*c + D*d <= E * (A*a + B*b):
        return True
    else:
        return False

def check(a, b, c, d):
    if check_weight(a, b, c, d) and check_conc(a, b, c, d):
        return True
    else:
        return False

max_conc = 0
max_sugar_water = 0
max_sugar = 0

for a in range(1, 31):
    for b in range(1, 31):
        for c in range(1, 31):
            for d in range(1, 31):
                if check(a, b, c, d) and max_conc <= 100*(C*c + D*d)/(100*A*a + 100*B*b + C*c + D*d):
                    max_conc = 100*(C*c + D*d)/(100*A*a + 100*B*b + C*c + D*d)
                    max_sugar = C*c + D*d
                    max_sugar_water = 100*A*a + 100*B*b + C*c + D*d

print(max_sugar_water, max_sugar)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)
water = list(set(water))

result = [[0,a*100,0]]
for i in water:
    for x in range(301):
        for y in range(301):
            if i > 0 and c*x+d*y > 0 and c*x+d*y<=i*e and (c*x+d*y+100*i)<=f:
                result.append([100*(c*x+d*y)/(c*x+d*y+100*i), c*x+d*y+100*i, c*x+d*y])
            else:
                break
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)
water = list(set(water))

result = [[0,a*100,0]]
for i in water:
    for x in range(301):
        for y in range(301):
            if c*x+d*y > 0 and c*x+d*y<=i*e and (c*x+d*y+100*i)<=f:
                result.append([100*(c*x+d*y)/(c*x+d*y+100*i), c*x+d*y+100*i, c*x+d*y])
            else:
                break
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)

water = list(set(water))
sugar = []
for i in range(301):
    for j in range(301):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a*100,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            break
    if sugar[j]!=0 and i != 0 and (i*100+sugar[j])<=f:
        result.append([100000*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)

water = list(set(water))
sugar = []
for i in range(301):
    for j in range(301):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a*100,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            break
    if sugar[j]!=0 and (i*100+sugar[j])<=f:
        result.append([100000*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)

water = list(set(water))
sugar = []
for i in range(301):
    for j in range(301):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a*100,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            print(sugar[j-1])
            break
    if sugar[j]!=0 and (i*100+sugar[j])<=f:
        result.append([100000*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)

water = list(set(water))
sugar = []
for i in range(301):
    for j in range(301):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a*100,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            break
    if sugar[j]!=0 and (i*100+sugar[j])<=f:
        result.append([100*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)
        else:
            break
water = list(set(water))
sugar = []
for i in range(301):
    for j in range(301):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a*100,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            break
    if sugar[j]!=0 and (i*100+sugar[j])<=f:
        result.append([100*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)
        else:
            break
water = list(set(water))
sugar = []
for i in range(300):
    for j in range(300):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a*100,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            break
    if sugar[j]!=0 and (i*100+sugar[j])<=f:
        result.append([100*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
water = []
for i in range(31):
    for j in range(31):
        if (a*i+b*j)*100<=f:
            water.append(a*i+b*j)
        else:
            break
water = list(set(water))
sugar = []
for i in range(300):
    for j in range(300):
        sugar.append(c*i+d*j)
sugar = list(set(sugar))
sugar.sort(reverse=True)
result = [[0,a,0]]
for i in water:
    j = 0
    while sugar[j]>i*e:
        j += 1
        if j >= len(sugar):
            break
    if sugar[j]!=0 and (i*100+sugar[j])<=f:
        result.append([100*sugar[j]/(sugar[j]+i), i*100+sugar[j], sugar[j]])
result.sort(reverse=True)
print(result[0][1], result[0][2])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

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

for a in range(31):
    for b in range(31):
        for c in range(91):       #範囲の指定がよくわからない
            for d in range(91):  #範囲の指定がよくわからない
                w = 100*A*a+100*B*b #水の質量
                s = C*c+D*d        #砂糖の質量
                if w == 0  or w + s >= F: #ダメな条件 砂糖０はあり得る
                    break
                else:
                    if s/(w+s) <= E/(100 + E):
                        ans = 100 * s/(w+s)
                        X.append([ans,w + s, s])
X = sorted(X,key=itemgetter(0),reverse = True) 
#print(X)
print(X[0][1],X[0][2])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

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

for a in range(31):
    for b in range(31):
        for c in range(71):       #範囲の指定がよくわからない
            for d in range(71):  #範囲の指定がよくわからない
                w = 100*A*a+100*B*b #水の質量
                s = C*c+D*d        #砂糖の質量
                if w == 0  or w + s >= F: #ダメな条件 砂糖０はあり得る
                    break
                else:
                    if s/(w+s) <= E/(100 + E):
                        ans = 100 * s/(w+s)
                        X.append([ans,w + s, s])
X = sorted(X,key=itemgetter(0),reverse = True) 
#print(X)
print(X[0][1],X[0][2])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

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

for a in range(31):
    for b in range(31):
        for c in range(51):
            for d in range(51):
                w = 100*A*a+100*B*b #砂糖水の質量
                s = C*c+D*d        #砂糖の質量
                if w == 0  or w + s >= F: #ダメな条件
                    break
                else:
                    if s/(w+s) <= E/(100 + E):
                        ans = 100 * s/(w+s)
                        X.append([ans,w + s, s])
X = sorted(X,key=itemgetter(0),reverse = True) 
#print(X)
print(X[0][1],X[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        water = 100 * (a * i + b * j)
        if water > f:
            break
        if water == 0:
            continue
        print(water)
        sugar_max = (a * i + b * j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        water = 100 * (a * i + b * j)
        if water > f:
            break
        if water == 0:
            continue
        print(water)
        sugar_max = (a * i + b * j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
if kouho:
    print(kouho[0][1], kouho[0][2])