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 sys
from decimal import Decimal

def main():

    # Get Args
    args = _input_args()  # get arguments as an array from console/script parameters.

    # Call main Logic
    water, sugar = _main(args)

    # Output a result in a correct way.
    _output_result(water, sugar)

def get_E_limit(a,b,c,d,A,B,C,D):
    result = (C*c + D*d) / (A*a + B*b)
    return result

def get_persentage_of_sugar(a, b, c, d, A, B, C, D):
    result = 100 * Decimal(get_total_sugar(c, d, C, D)) / Decimal((get_total_water(a, b, A, B) + get_total_sugar(c, d, C, D)))
    return result

def get_total_water(a, b, A, B):
    result = (100 * A * a) + (100 * B * b)
    return result

def get_total_sugar(c, d, C, D):
    result = (C * c) + (D * d)
    return result

def is_overflowed(a, b, c, d, A, B, C, D, F):
    result = not (100*A*a + 100*B*b + C*c + D*d <= F)
    return result

def _main(args):
    """Write Main Logic here for the contest.

    :param args: arguments
    :type args: list
    :return: result
    :rtype: depends on your logic.
    """
    # Extract arguments.
    A = args[0]
    B = args[1]
    C = args[2]
    D = args[3]
    E = args[4]
    F = args[5]

    # constraints

    #  C*c + D*d / A*a + B*b <= E ->
    #  C*c + D*d <= E(100A*a + 100B*b)

    # A*a + B*b + c + d <= F

    # max a < int(F/100A) + 1
    # max b < int(F/100B) + 1
    # max c < int(E * F/100) / C   + 1
    # max d < int(E * F/100) / D   + 1

    a_max = int(F/A/100) + 1
    b_max = int(D/B/100) + 1
    c_max = int((E*F/100)/C) + 1
    d_max = int((E*F/100)/D) + 1

    max_persentage = 0
    water_when_max = 0
    sugar_when_max = 0

    for a in range(a_max + 1):
        for b in range(b_max + 1):
            if a == 0 and b == 0:
                continue
            for c in range(c_max + 1):
                for d in range(d_max + 1):
                    if not is_overflowed(a, b, c, d, A, B, C, D, F):
                        try:
                            persentage = get_persentage_of_sugar(a, b, c, d, A, B, C, D)
                            if get_E_limit(a,b,c,d, A,B,C,D) <= E and persentage > max_persentage:
                                max_persentage = persentage
                                water_when_max = get_total_water(a, b, A, B) + get_total_sugar(c, d, C, D)
                                sugar_when_max = get_total_sugar(c, d, C, D)
                        except ZeroDivisionError:
                            pass

    return water_when_max, sugar_when_max


def _input_args():

    arguments = _input().split()  # ptn2: get args from 1 line console prompt with space separated.
    arguments = list(map(int, arguments))  # cast elements to int for example.

    return arguments  # This will be array.


def _input():
    # If Subject requires interactive input, use this and patch mock in unittest.
    return input()  # Change if necessary.

def _output_result(water, sugar):
    print('{0} {1}'.format(str(water), str(sugar)))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():

    # Get Args
    args = _input_args()  # get arguments as an array from console/script parameters.

    # Call main Logic
    water, sugar = _main(args)

    # Output a result in a correct way.
    _output_result(water, sugar)

def get_E_limit(a,b,c,d,A,B,C,D):
    result = (C*c + D*d) / (A*a + B*b)
    return result

def get_persentage_of_sugar(a, b, c, d, A, B, C, D):
    result= 100 * get_total_sugar(c, d, C, D) / (get_total_water(a, b, A, B) + get_total_sugar(c, d, C, D))
    return result

def get_total_water(a, b, A, B):
    result = (100 * A * a) + (100 * B * b)
    return result

def get_total_sugar(c, d, C, D):
    result = (C * c) + (D * d)
    return result

def is_overflowed(a, b, c, d, A, B, C, D, F):
    result = not (100*A*a + 100*B*b + C*c + D*d <= F)
    return result

def _main(args):
    """Write Main Logic here for the contest.

    :param args: arguments
    :type args: list
    :return: result
    :rtype: depends on your logic.
    """
    # Extract arguments.
    A = args[0]
    B = args[1]
    C = args[2]
    D = args[3]
    E = args[4]
    F = args[5]

    # constraints

    #  C*c + D*d / A*a + B*b <= E ->
    #  C*c + D*d <= E(100A*a + 100B*b)

    # A*a + B*b + c + d <= F

    # max a < int(F/100A) + 1
    # max b < int(F/100B) + 1
    # max c < int(E * F/100) / C   + 1
    # max d < int(E * F/100) / D   + 1

    a_max = int(F/A/100) + 1
    b_max = int(D/B/100) + 1
    c_max = int((E*F/100)/C) + 1
    d_max = int((E*F/100)/D) + 1

    max_persentage = 0
    water_when_max = 0
    sugar_when_max = 0

    for a in range(a_max + 1):
        for b in range(b_max + 1):
            if a == 0 and b == 0:
                continue
            for c in range(c_max + 1):
                for d in range(d_max + 1):
                    if not is_overflowed(a, b, c, d, A, B, C, D, F):
                        try:
                            persentage = get_persentage_of_sugar(a, b, c, d, A, B, C, D)
                            if get_E_limit(a,b,c,d, A,B,C,D) <= E and persentage > max_persentage:
                                max_persentage = persentage
                                water_when_max = get_total_water(a, b, A, B) + get_total_sugar(c, d, C, D)
                                sugar_when_max = get_total_sugar(c, d, C, D)
                        except ZeroDivisionError:
                            pass

    return water_when_max, sugar_when_max


def _input_args():

    arguments = _input().split()  # ptn2: get args from 1 line console prompt with space separated.
    arguments = list(map(int, arguments))  # cast elements to int for example.

    return arguments  # This will be array.


def _input():
    # If Subject requires interactive input, use this and patch mock in unittest.
    return input()  # Change if necessary.

def _output_result(water, sugar):
    print('{0} {1}'.format(str(water), str(sugar)))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():

    # Get Args
    args = _input_args()  # get arguments as an array from console/script parameters.

    # Call main Logic
    water, sugar = _main(args)

    # Output a result in a correct way.
    _output_result(water, sugar)

def get_E_limit(a,b,c,d,A,B,C,D):
    result = (C*c + D*d) / (A*a + B*b)
    return result

def get_persentage_of_sugar(a, b, c, d, A, B, C, D):
    result= 100 * get_total_sugar(c, d, C, D) / (get_total_water(a, b, A, B) + get_total_sugar(c, d, C, D))
    return result

def get_total_water(a, b, A, B):
    result = (100 * A * a) + (100 * B * b)
    return result

def get_total_sugar(c, d, C, D):
    result = (C * c) + (D * d)
    return result

def is_overflowed(a, b, c, d, A, B, C, D, F):
    result = not (100*A*a + 100*B*b + C*c + D*d <= F)
    return result

def _main(args):
    """Write Main Logic here for the contest.

    :param args: arguments
    :type args: list
    :return: result
    :rtype: depends on your logic.
    """
    # Extract arguments.
    A = args[0]
    B = args[1]
    C = args[2]
    D = args[3]
    E = args[4]
    F = args[5]

    # constraints

    #  C*c + D*d / A*a + B*b <= E ->
    #  C*c + D*d <= E(100A*a + 100B*b)

    # A*a + B*b + c + d <= F

    # max a < int(F/100A) + 1
    # max b < int(F/100B) + 1
    # max c < int(E * F/100) / C   + 1
    # max d < int(E * F/100) / D   + 1

    a_max = int(F/A/100) + 1
    b_max = int(D/B/100) + 1
    c_max = int((E*F/100)/C) + 1
    d_max = int((E*F/100)/D) + 1

    max_persentage = 0
    water_when_max = 0
    sugar_when_max = 0

    for a in range(a_max + 1):
        for b in range(b_max + 1):
            for c in range(c_max + 1):
                for d in range(d_max + 1):
                    if not is_overflowed(a, b, c, d, A, B, C, D, F):
                        try:
                            persentage = get_persentage_of_sugar(a, b, c, d, A, B, C, D)
                            if get_E_limit(a,b,c,d, A,B,C,D) <= E and persentage > max_persentage:
                                max_persentage = persentage
                                water_when_max = get_total_water(a, b, A, B) + get_total_sugar(c, d, C, D)
                                sugar_when_max = get_total_sugar(c, d, C, D)
                        except ZeroDivisionError:
                            pass

    return water_when_max, sugar_when_max


def _input_args():

    arguments = _input().split()  # ptn2: get args from 1 line console prompt with space separated.
    arguments = list(map(int, arguments))  # cast elements to int for example.

    return arguments  # This will be array.


def _input():
    # If Subject requires interactive input, use this and patch mock in unittest.
    return input()  # Change if necessary.

def _output_result(water, sugar):
    print('{0} {1}'.format(str(water), str(sugar)))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

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

amax = f // (a * 100)
bmax = f // (b * 100)

maxd = 0
maxw = 0
maxs = 0
for i in range(amax + 1):
    for j in range(bmax + 1):
        if i == j == 0:
            continue
        w = i * a + j * b
        if w * 100 > f:
            continue
        cmax = (f - w * 100) // c
        dmax = (f - w * 100) // d
        for k in range(cmax + 1):
            for l in range(dmax + 1):
                s = k * c + l * d
                if w * e < s:
                    break
                if f < w * 100 + s:
                    break
                div = s / (w * 100 + s)
                if maxd < div:
                    maxw = w * 100 + s
                    maxs = s
                    maxd = div

print(maxw, maxs)

Submission status: Wrong Answer

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

mx = mx_x = mx_y = 0
for i in xrange(31):
    for j in xrange(16):
        if i + j == 0 or 100*A*i + 100*B*j > F: continue
        for k in xrange(101):
            for l in xrange(51):
                if 100*A*i + 100*B*j + C*k + D*l > F: continue
                if (A*i + B*j)*E < C*k + D*l: continue
                a = 100*A*i + 100*B*j
                b = C*k + D*l
                if 100*b > mx*(a + b):
                    mx_x = a + b
                    mx_y = b
                    mx = 100*b
print mx_x, mx_y

Submission status: Wrong Answer

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

mx = mx_x = mx_y = 0
for i in xrange(31):
    for j in xrange(31):
        if i + j == 0 or A*i + B*j > F: continue
        for k in xrange(101):
            for l in xrange(101):
                if 100*A*i + 100*B*j + C*k + D*l > F: continue
                if (A*i + B*j)*E < C*k + D*l: continue
                a = 100*A*i + 100*B*j
                b = C*k + D*l
                if 100*b > mx*(a + b):
                    mx_x = a + b
                    mx_y = b
                    mx = 100*b
print mx_x, mx_y

Submission status: Wrong Answer

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

mx = mx_x = mx_y = 0
for i in xrange(31):
    for j in xrange(31):
        if i + j == 0 or A*i + B*j > F: continue
        for k in xrange(101):
            for l in xrange(101):
                if 100*A*i + 100*B*j + C*k + D*l > F: continue
                if (A*i + B*j)*E < C*k + D*l: continue
                a = 100*A*i + 100*B*j
                b = C*k + D*l
                if 100.0*b/(a + b) > mx:
                    mx_x = a + b
                    mx_y = b
                    mx = 100.0*b/(a + b)
print mx_x, mx_y

Submission status: Wrong Answer

Solution code:
#import numpy as np

def FindMaxCon(res, water, C, D, E):
  c = 0
  d = 0
  tmpCon = 0
  dp = list([False] * 3001)
  dp[0] = True
  for i in range(3001):
    if(i - C >= 0 and i - D >= 0):
      dp[i] = dp[i - C] or dp[i - D]
    elif(i - C >= 0):
      dp[i] = dp[i - C]
    elif(i - D >= 0):
      dp[i] = dp[i - D]
  tmpSugar = 0
  for i in range(min(res, int(E * water / 100)) + 1):
    if(dp[i]):
      tmpSugar = i
  ans = tmpSugar
  return ans

A, B, C, D, E, F = (int(_) for _ in input().split())
amax = F / (A * 100)
bmax = F / (B * 100)
amax = int(amax)
bmax = int(bmax)
water = 0
sugar = 0
waterAns= 0
sugarAns = 0
con = 0
conAns = 0
for a in range(1, amax + 1):
  for b in range(bmax + 1):
    water = 100 * (a * A + b * B)
    if(water > F):
      continue
    else:
      res = F - water
      tmp = FindMaxCon(res, water, C, D, E)
      sugar = tmp
      con = sugar / water
      if(con > conAns):
        conAns = con
        waterAns = water
        sugarAns = sugar
answer = str(waterAns + sugarAns) + " " + str(sugarAns)
print(answer)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
A,B,C,D,E,F=map(int, raw_input().split())
#print A,B,C,D,E,F

sugar_list=[0]*(F+1)
i=0
while i <= F :
	for j in range(F):
		val=C*i+D*j
		if val > F:
			break
		elif val <= F:
			sugar_list[val]=1
	i+=1

#print "# Sugar"
#print sugar_list

#Water
water_list=[0]*(F/100+1)
#print water_list
loop_cnt=F/100+1

i=0
while i <= loop_cnt:
	for j in range(loop_cnt):
		val=A*i+B*j
		if val > F/100:
			break
		else:
			#print i,j,val
			water_list[val]=1
	i+=1

#print "# Water"
#print water_list

max_noudo=float(E)/(100+E)
#print max_noudo


hwm=0
water_ans=0
sugar_ans=0
for i in range(1,len(water_list)):
	for j in range(len(sugar_list)):
		if water_list[i]*sugar_list[j]==1 and i*100+j<=F and float(j)/(i*100+j)<=max_noudo:
			if float(j)/(i*100+j)>hwm:
				hwm=float(j)/(i*100+j)
				water_ans=i*100
				sugar_ans=j
				
if sugar_ans==0:
	water_ans=F

print water_ans+ sugar_ans, sugar_ans

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
A,B,C,D,E,F=map(int, raw_input().split())
#print A,B,C,D,E,F

sugar_list=[0]*(F+1)
i=0
while i <= F :
	for j in range(F):
		val=C*i+D*j
		if val > F:
			break
		elif val <= F:
			sugar_list[val]=1
	i+=1

#print "# Sugar"
#print sugar_list

#Water
water_list=[0]*(F/100+1)
#print water_list
loop_cnt=F/100+1

i=0
while i <= loop_cnt:
	for j in range(loop_cnt):
		val=A*i+B*j
		if val > F/100:
			break
		else:
			#print i,j,val
			water_list[val]=1
	i+=1

#print "# Water"
#print water_list

max_noudo=float(E)/(100+E)
#print max_noudo


hwm=0
water_ans=0
sugar_ans=0
for i in range(1,len(water_list)):
	for j in range(len(sugar_list)):
		if water_list[i]*sugar_list[j]==1 and i*100+j<=F and float(j)/(i*100+j)<=max_noudo:
			if float(j)/(i*100+j)>hwm:
				hwm=float(j)/(i*100+j)
				water_ans=i*100
				sugar_ans=j
				
if water_ans==0 and sugar_ans==0:
	water_ans=F

print water_ans+ sugar_ans, sugar_ans

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
A,B,C,D,E,F=map(int, raw_input().split())
#print A,B,C,D,E,F

sugar_list=[0]*(F+1)
i=0
while i <= F :
	for j in range(F):
		val=C*i+D*j
		if val > F:
			break
		elif val <= F:
			sugar_list[val]=1
	i+=1

#print "# Sugar"
#print sugar_list

#Water
water_list=[0]*(F+1)
i=0
while i <= F:
	for j in range(0, 30):
		val=100*A*i+100*B*j
		if val > F:
			break
		else:
			water_list[val]=1
	i+=1

#print "# Water"
#print water_list


max_noudo=float(E)/(100+E)
#print max_noudo


hwm=0
water_ans=0
sugar_ans=0
for i in range(1,len(water_list)):
	for j in range(len(sugar_list)):
		if water_list[i]*sugar_list[j]==1 and i+j<=F and float(j)/(i+j)<=max_noudo:
			if float(j)/(i+j)>hwm:
				hwm=float(j)/(i+j)
				water_ans=i
				sugar_ans=j
				
if water_ans==0 and sugar_ans==0:
	water_ans=F

print water_ans+ sugar_ans, sugar_ans

Submission status: Wrong Answer

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

sugar_list=[]
i=0
while C*i <=F :
	for j in range(F):
		val=C*i+D*j
		#print C,D,i,j,val
		if val > F:
			break
		else:
			if val not in sugar_list:
				#print i,j,val
				sugar_list.append(val)
	i+=1

sugar_list.sort()
#print "# Sugar"
#print sugar_list


#Water
water_list=[]
i=0
while A*100*i <= F:
	for j in range(0, 30):
		val=100*A*i+100*B*j
		if val==0:
			continue
		elif val > F:
			break
		else:
			if val not in water_list:
				water_list.append(val)
	i+=1

water_list.sort()
#print "# Water"
#print water_list

max_noudo=float(E)*100/(100+E)
#print "# max_noudo"
#print max_noudo

hwm=0
water_ans=0
sugar_ans=0
for i in range(len(water_list)):
	for j in range(len(sugar_list)):
		noudo= 100*float(sugar_list[j])/(water_list[i]+sugar_list[j])
		#print water_list[i]+sugar_list[j],sugar_list[j],noudo
		
		if noudo>hwm and noudo<= max_noudo and water_list[i]+sugar_list[j]<F:
			hwm=noudo
			water_ans=water_list[i]
			sugar_ans=sugar_list[j]
			#print water_ans,sugar_ans,noudo


if water_ans==0 and sugar_ans==0:
	print water_list[0], sugar_ans,0
else:
	print water_ans+sugar_ans, sugar_ans

Submission status: Wrong Answer

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

#Sugar
max_sugar=E*F/(100+E)
max_loop=max_sugar/min(C,D)
#print max_sugar

sugar_list=[]
i=0
while C*i <=F :
	for j in range(0, max_loop):
		val=C*i+D*j
		if val > F:
			break
		else:
			if val not in sugar_list:
				#print i,j,val
				sugar_list.append(val)
	i+=1

sugar_list.sort()
#print "# Sugar"
#print sugar_list


#Water
water_list=[]
i=0
while A*100*i <= F:
	for j in range(0, 30):
		val=100*A*i+100*B*j
		if val==0:
			continue
		elif val >= F:
			break
		else:
			if val not in water_list:
				water_list.append(val)
	i+=1

water_list.sort()
#print "# Water"
#print water_list

max_noudo=float(E)*100/(100+E)
#print max_noudo

hwm=0
water_ans=0
sugar_ans=0
for i in range(len(water_list)):
	for j in range(len(sugar_list)):
		noudo= 100*float(sugar_list[j])/(water_list[i]+sugar_list[j])
		#print water_list[i]+sugar_list[j],sugar_list[j],noudo
		
		if noudo>hwm and noudo<= max_noudo and water_list[i]+sugar_list[j]<F:
			hwm=noudo
			water_ans=water_list[i]
			sugar_ans=sugar_list[j]
			#print water_ans,sugar_ans,noudo

print water_ans+sugar_ans, sugar_ans

Submission status: Wrong Answer

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

#Sugar
max_sugar=E*F/(100+E)
max_loop=max_sugar/min(C,D)
#print max_sugar

sugar_list=[]
i=0
while C*i <= max_sugar:
	for j in range(0, max_loop):
		val=C*i+D*j
		if val > max_sugar:
			break
		else:
			if val not in sugar_list:
				#print i,j,val
				sugar_list.append(val)
	i+=1

sugar_list.sort()
#print "# Sugar"
#print sugar_list


#Water
water_list=[]
i=0
while A*100*i < F:
	for j in range(0, 30):
		val=100*A*i+100*B*j
		if val==0:
			continue
		elif val >= F:
			break
		else:
			if val not in water_list:
				water_list.append(val)
	i+=1

water_list.sort()
#print "# Water"
#print water_list

max_noudo=float(E)*100/(100+E)
#print max_noudo

hwm=0
water_ans=0
sugar_ans=0
for i in range(len(water_list)):
	for j in range(len(sugar_list)):
		noudo= 100*float(sugar_list[j])/(water_list[i]+sugar_list[j])
		#print water_list[i]+sugar_list[j],sugar_list[j],noudo
		
		if noudo>hwm and noudo<= max_noudo and water_list[i]+sugar_list[j]<F:
			hwm=noudo
			water_ans=water_list[i]
			sugar_ans=sugar_list[j]
			#print water_ans,sugar_ans,noudo

print water_ans+sugar_ans, sugar_ans

Submission status: Wrong Answer

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

#Sugar
max_sugar=E*F/(100+E)
max_loop=max_sugar/min(C,D)

sugar_list=[]
i=0
while C*i <= max_sugar:
	for j in range(0, max_loop):
		val=C*i+D*j
		if val > max_sugar:
			break
		else:
			if val not in sugar_list:
				#print i,j,val
				sugar_list.append(val)
	i+=1

sugar_list.sort()
#print "# Sugar"
#print sugar_list


#Water
water_list=[]
i=0
while A*100*i < F:
	for j in range(0, 30):
		val=100*A*i+100*B*j
		if val==0:
			continue
		elif val > F:
			break
		else:
			if val not in water_list:
				water_list.append(val)
	i+=1

water_list.sort()
#print "# Water"
#print water_list

max_noudo=float(E)*100/(100+E)
#print max_noudo

hwm=0
water_ans=0
sugar_ans=0
for i in range(len(water_list)):
	for j in range(len(sugar_list)):
		noudo= 100*float(sugar_list[j])/(water_list[i]+sugar_list[j])
		
		if noudo>hwm and noudo<= max_noudo and water_list[i]+sugar_list[j]<F:
			hwm=noudo
			water_ans=water_list[i]
			sugar_ans=sugar_list[j]
			#print water_ans,sugar_ans,noudo

print water_ans+sugar_ans, sugar_ans

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
rw = rs = 0
conc = 0.0
s = set()
t = set()
for ai in range(30):
    for bi in range(15):
        wat = 100*(a*ai+b*bi)
        if wat > f: continue
        if wat in s:
            continue
        else:
            s.add(wat)
for ci in range(3000):
    for di in range(1500):
        sug = c*ci+d*di
        if sug > f: continue
        if sug in t:
            continue
        else:
            t.add(sug)
for w in s:
    if w == 0: continue
    for x in t:
        if w+x <= f and x/w <= 0.01*e:
            if conc < (100*x)/(x+w):
                conc = (100*x)/(x+w)
                rw = w; rs = x
print(rw+rs,rs)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
rw = rs = 0
conc = 0.0
s = set()
t = set()
for ai in range(30):
    for bi in range(15):
        wat = 100*(a*ai+b*bi)
        if wat > f: continue
        if wat in s:
            continue
        else:
            s.add(wat)
for ci in range(3000):
    for di in range(1500):
        sug = c*ci+d*di
        if sug > f: continue
        if sug in t:
            continue
        else:
            t.add(sug)
for w in s:
    for x in t:
        if w + x == 0:continue
        if w+x <= f and (100*x)/(x+w) <= e:
            if conc < (100*x)/(x+w):
                conc = (100*x)/(x+w)
                rw = w; rs = x
print(rw+rs,rs)

Submission status: Wrong Answer

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

ans_wat = 0
ans_sug = 0
ans_rate = 0

maxrate = 100 * e / (e + 100)

for i in range(31):
    for j in range(31):
        water = (i * a + j * b) * 100
        if (water <= f and water):
            nsug = min(f - water, water)
            for k in range(nsug):
                l = (nsug - k*c)
                suger = k * c + l * d
                rate = 100 * suger / (suger + water)
                if(ans_rate <= rate) and (rate <= maxrate):
                    ans_rate = rate
                    ans_sug = suger
                    ans_wat = water

print(ans_wat+ans_sug,ans_sug)

Submission status: Wrong Answer

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

ans_wat = 0
ans_sug = 0
ans_rate = 0

for i in range(31):#Aの投入数
  for j in range(31):#Bの投入数
      wat=(i*a+j*b)*100
      if wat<=f and wat:
          psug = min(f-wat,wat//100*e)
          for k in range(30+1):
              l = (psug-c*k)//d
              sug = k*c+l*d
              rate = 100*sug/(wat+sug)
              if ans_rate<rate and rate<=e and wat+sug<=f:
                  ans_wat = wat
                  ans_sug = sug
                  ans_rate = rate

print(ans_wat+ans_sug,ans_sug)

Submission status: Wrong Answer

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

ans_wat = 0
ans_sug = 0
ans_rate = 0

for i in range(31):#Aの投入数
  for j in range(31):#Bの投入数
      wat=(i*a+j*b)*100
      if wat<=f and wat:
          psug = min(f-wat,wat//100*e)
          for k in range(psug//c+1):
              l = (psug-c*k)//d
              sug = k*c+l*d
              rate = 100*sug/(wat+sug)
              if ans_rate<rate and rate<=e and wat+sug<=f:
                  ans_wat = wat
                  ans_sug = sug
                  ans_rate = rate

print(ans_wat+ans_sug,ans_sug)

Submission status: Wrong Answer

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

ans_wat = 0
ans_sug = 0
ans_rate = 0

for i in range(0,31):#Aの投入数
  for j in range(0,31):#Bの投入数
      wat=(i*a+j*b)*100
      if wat<=f and wat:
          psug = min(f-wat,wat//100*e)
          for k in range(psug//c+1):
              l = (psug-c*k)//d
              sug = k*c+l*d
              rate = 100*sug/(wat+sug)
              if ans_rate<rate and wat+sug<=f:
                  ans_wat = wat
                  ans_sug = sug
                  ans_rate = rate

print(ans_wat+ans_sug,ans_sug)

Submission status: Wrong Answer

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

ans_wat = 0
ans_sug = 0
ans_rate = 0

for i in range(0,31):#Aの投入数
  for j in range(0,31):#Bの投入数
      wat=(i*a+j*b)*100
      if wat<=f and wat:
          psug = min(f-wat,wat//100*e)
          for k in range(psug//c+1):
              l = (psug-c*k)//d
              sug = k*c+l*d
              rate = sug/(wat+sug)
              if ans_rate<rate and wat+sug<=f:
                  ans_wat = wat
                  ans_sug = sug
                  ans_rate = rate

print(ans_wat+ans_sug,ans_sug)

Submission status: Wrong Answer

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

ans_wat = 0
ans_sug = 0
ans_rate = 0

for i in range(0,31):#Aの投入数
  for j in range(0,31):#Bの投入数
      wat=(i*a+j*b)*100
      if wat<=f and wat:
          psug = min(f-wat,wat//100*e)
          for k in range(psug//c+1):
              l = (psug-c*k)//d
              sug = k*c+l*d
              rate = sug/(wat+sug)
              if ans_rate<rate :
                  ans_wat = wat
                  ans_sug = sug
                  ans_rate = rate

print(ans_wat+ans_sug,ans_sug)

Submission status: Wrong Answer

Solution code:


A,B,C,D,E,F = list(map(int, input().split()))
#x is a list which represents for the volumn of water
x = set()

#y is a list which represents for the volumn of sugar
y = set()

for i in range(F//C+1):
    for j in range((F-C*i)//D+1):
        if i + j == 0:
            continue
        y.add( i * C + j * D)

for i in range(F//(100 * A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        if i + j == 0:
            continue
        x.add(i * A * 100 + j * B * 100)
#print(x)
#print(y)
ans_sweetwater = 1
ans_sugar = -1
#ans_density = -1
#density = E/(100+E)
#print("density: ",density)
for m in x:
    for n in y:
        #tmp_density = n/(m+n)
        if m + n <= F and m*E/100 >= n and ans_sugar/ans_sweetwater <= n/(m+n):
            ans_sweetwater =  m + n
            ans_sugar = n
            #ans_density = tmp_density
print(ans_sweetwater,ans_sugar)

Submission status: Wrong Answer

Solution code:
import sys

A,B,C,D,E,F = list(map(int, input().split()))
#x is a list which represents for the volumn of water
x = set()

#y is a list which represents for the volumn of sugar
y = set()

for i in range(F//C+1):
    for j in range((F-C*i)//D+1):
        if i == j == 0:
            continue
        tmp_y = i * C + j * D
        y.add(tmp_y)

for i in range(F//(100 * A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        if i == j == 0:
            continue
        tmp_x = i * A * 100 + j * B * 100
        x.add(tmp_x)
#print(x)
#print(y)
ans_sweetwater = 1
ans_sugar = -1
#ans_density = -1
#density = E/(100+E)
#print("density: ",density)
for m in x:
    for n in y:
        #tmp_density = n/(m+n)
        if m + n <= F and m*E/100 >= n and ans_sugar/ans_sweetwater <= n/(m+n):
            ans_sweetwater =  m + n
            ans_sugar = n
            #ans_density = tmp_density
print(ans_sweetwater,ans_sugar)

Submission status: Wrong Answer

Solution code:
import sys

A,B,C,D,E,F = list(map(int, input().split()))
#x is a list which represents for the volumn of water
x = set()

#y is a list which represents for the volumn of sugar
y = set()

for i in range(F//C+1):
    for j in range((F-C*i)//D+1):
        if i == j == 0:
            continue
        tmp_y = i * C + j * D
        y.add(tmp_y)

for i in range(F//(100 * A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        if i == j == 0:
            continue
        tmp_x = i * A * 100 + j * B * 100
        x.add(tmp_x)
#print(x)
#print(y)
ans_sweetwater = 1
ans_sugar = -1
#ans_density = -1
#density = E/(100+E)
#print("density: ",density)
for m in x:
    for n in y:
        #tmp_density = n/(m+n)
        if m + n <= F and m/100*E >= n and ans_sugar/ans_sweetwater <= n/(m+n):
            ans_sweetwater =  m + n
            ans_sugar = n
            #ans_density = tmp_density
print(ans_sweetwater,ans_sugar)

Submission status: Wrong Answer

Solution code:
import sys

A,B,C,D,E,F = list(map(int, input().split()))
#x is a list which represents for the volumn of water
x = set()

#y is a list which represents for the volumn of sugar
y = set()

for i in range(F//C+1):
    for j in range((F-C*i)//D+1):
        if i == j == 0:
            continue
        tmp_y = i * C + j * D
        y.add(tmp_y)

for i in range(F//(100 * A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        if i == j == 0:
            continue
        tmp_x = i * A * 100 + j * B * 100
        x.add(tmp_x)
#print(x)
#print(y)
ans_sweetwater = 1
ans_sugar = -1
ans_density = -1
density = E/(100+E)
#print("density: ",density)
for m in x:
    for n in y:
        tmp_density = n/(m+n)
        if m + n <= F and m/100*E >= n and ans_sugar/ans_sweetwater <= tmp_density:
            ans_sweetwater =  m + n
            ans_sugar = n
            #ans_density = tmp_density
print(ans_sweetwater,ans_sugar)