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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/23
Solved on 2019/3/
@author: shinjisu
"""


# ABC 074 C - Sugar Water

def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替
class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def conc(maxconc, water, sugar):
    global E, F
    db = Debug()
    db.off()
    if water == 0:
        return 0
    conc = sugar / (sugar+water*100) * 100
    db.dmp((maxconc, water, sugar, conc),'maxconc, water, sugar, conc')
    if sugar/water > E:  # not all melted
        db.dmp('not all melted')
        return -11
    elif water*100+sugar > F:  # overflow
        db.dmp('overflow')
        return -5
    elif conc > maxconc:
        db.dmp('MAX UPDATED')
        return conc
    else:
        return -1


def prob():
    global E, F
    db = Debug()
    db.off()
    A, B, C, D, E, F = getIntList()
    db.dmp((A, B, C, D, E, F), 'A, B, C, D, E, F')
    a = F // 100 // A
    b = F // 100 // B
    c = F // C
    d = F // D
    db.dmp((a, b, c, d), 'a, b, c, d')
    maxConc, maxWater, maxSugar = -1.0, 0, 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            water = A*i + B*j
            if water*100 >= F:
                continue
            for n in range(0, c+1):
                for m in range(0, d+1):
                    sugar = C*n + D*m
                    cn = conc(maxConc, water, sugar)
                    if cn > 0:
                        maxConc, maxWater, maxSugar = cn, water, sugar
                    elif cn < -10:
                        break

    db.dmp((maxConc, maxWater, maxSugar),'max conc, water, sugar')
    return maxWater*100+maxSugar, maxSugar


ans = prob()
for elm in ans:
    print(elm, end=' ')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/22
Solved on 2019/3/
@author: shinjisu
"""


# ABC 0xx C xxx
#import math
#import numpy as np

def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替
class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def conc(maxconc, water, sugar):
    global E, F
    db = Debug()
    db.off()
    if water == 0:
        return 0
    conc = sugar / (sugar+water*100) * 100
    db.dmp((maxconc, water, sugar, conc),'maxconc, water, sugar, conc')
    if sugar/water > E:  # not all melted
        db.dmp('not all melted')
        return -11
    elif water*100+sugar > F:  # overflow
        db.dmp('overflow')
        return -12
    elif conc > maxconc:
        db.dmp('MAX UPDATED')
        return conc
    else:
        return -1

def prob():
    global E, F
    db = Debug()
    db.off()
    A, B, C, D, E, F = getIntList()
    db.dmp((A, B, C, D, E, F), 'A, B, C, D, E, F')
    a = F // 100 // A
    b = F // 100 // B
    c = F // C
    d = F // D
    db.dmp((a, b, c, d), 'a, b, c, d')
    maxConc, maxWater, maxSugar = -1.0, 0, 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            water = A*i + B*j
            if water*100 >= F:
                continue
            for n in range(0, c+1):
                for m in range(0, d+1):
                    sugar = C*n + D*m
                    cn = conc(maxConc, water, sugar)
                    if cn > 0:
                        maxConc, maxWater, maxSugar = cn, water, sugar
                    elif cn < -10:
                        break

    db.dmp((maxConc, maxWater, maxSugar),'max conc, water, sugar')
    return maxWater*100+maxSugar, maxSugar


ans = prob()
for elm in ans:
    print(elm, end=' ')

Submission status: Wrong Answer

Solution code:
w1, w2, s1, s2, s_max, b_max = map(int, input().split())
waters = [0]
waters_base = [0]
while len(waters_base) > 0:
    base = waters_base.pop()
    water1 = base + 100 * w1
    water2 = base + 100 * w2
    if water1 not in waters and water1 <= b_max:
        waters.append(water1)
        waters_base.append(water1)
    if water2 not in waters and water2 <= b_max:
        waters.append(water2)
        waters_base.append(water2)
waters.pop(0)
sugars = [0]
sugars_base = [0]
while len(sugars_base) > 0:
    base = sugars_base.pop()
    sugar1 = base + s1
    sugar2 = base + s2
    if sugar1 not in sugars and sugar1 <= b_max:
        sugars.append(sugar1)
        sugars_base.append(sugar1)
    if sugar2 not in sugars and sugar2 <= b_max:
        sugars.append(sugar2)
        sugars_base.append(sugar2)
sugars.pop(0)
max_radio = -1
result = (-1, -1)
for water in waters:
    for sugar in sugars:
        if b_max < water + sugar:
            continue
        if water // 100 * s_max < sugar:
            continue
        ratio = sugar / (water + sugar)
        if max_radio < ratio:
            max_radio = ratio
            result = (water + sugar, sugar)
print(*result)

Submission status: Wrong Answer

Solution code:
import math
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        if subwater == 0:
                continue
        for c in range(1501):
            subsuger = C * c
            if subsuger <= subwater * E:
                if F - subwater * 100 - subsuger > 0:
                    subsuger += D * min(F - subwater * 100 - subsuger, ((subwater * E - subsuger) // D))
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))

Submission status: Wrong Answer

Solution code:
import math
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        if subwater == 0:
                continue
        for c in range(151):
            subsuger = C * c
            if subsuger <= subwater * E:
                subsuger += ((subwater * E - subsuger) // D) * D
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        for c in range(151):
            subsuger = C * c
            if subwater == 0:
                continue
            if subsuger <= subwater * E:
                subsuger += (subwater * E - subsuger) // D * D
                if subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(int(water) * 100 + int(suger), int(suger)))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        for c in range(151):
            subsuger = C * c
            if subwater == 0:
                continue
            if subsuger <= subwater * E:
                subsuger += ((subwater * E - subsuger) // D) * D
                if subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        for c in range(101):
            subsuger = C * c
            if subwater == 0:
                continue
            if subsuger <= subwater * E:
                subsuger += ((subwater * E - subsuger) // D ) * D
                if subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        for c in range(31):
            for d in range(31):
                subwater = A * a + B * b
                subsuger = C * c + D * d
                if subwater == 0:
                    continue 
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger)  > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
max=0
ans=[0,0]

wlist=[]
for ia in range((f//100*a)+1):
  for ib in range(((f-ia)//100*b)+1):
    if 100*a*ia+100*b*ib<=f and 100*a*ia+100*b*ib not in wlist:
      wlist.append(100*a*ia+100*b*ib)
wlist.sort()
wlist.remove(0)

if c==1 or d==1:
  slist=[j for j in range(f+1)]
else:
  slist=set()
  for ic in range((f//c)+1):
    for id in range(((f-ic)//d)+1):
      if c*ic+d*id<=f:
        slist.add(c*ic+d*id)
  slist=list(slist)
slist.sort()

for w in wlist:
  for s in slist:
    if w+s>f or e/100<s/w:
      break
    if max<100*s/(w+s):
      max=100*s/(w+s)
      ans=[w+s,s]
print(ans[0],ans[1])

Submission status: Wrong Answer

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

ws = []
for a in range(0,F+1,100*A):
	for b in range(0,F-a+1,100*B):
		x = a + b
		if x <= F:
			ws.append(x)
			
ss = []
for c in range(0,F+1,C):
	for d in range(0,F-c+1,D):
		y = c + d
		if y <= F:
			ss.append(y)
				
ans = [0,0,0]
for w in ws:
	for s in ss:
		ws = w+s
		
		if not ws <= F:
			continue
		
		if ws == 0:
			continue
		
		e = s/ws*100
				
		if not e <= E/(100+E)*100:
			continue
		
		if ans[0] < e:
			ans = [e,ws,s]
				
print(ans[1],ans[2])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F+1,100*A):
	for b in range(0,F-a+1,100*B):
		if a +b == 0:
			continue
		for c in range(0,F-a-b+1,C):
			for d in range(0,F-a-b-c+1,D):
				
				e = (c+d)/(a+b+c+d)
				
				if not (c+d)/(a+b) <= E/100:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [a+b+c+d,c+d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F+1,100*A):
	for b in range(0,F-a+1,100*B):
		if a == 0 and b == 0:
			continue
		for c in range(0,F-a-b+1,C):
			for d in range(0,F-a-b-c+1,D):
				
				e = (c+d)/(a+b+c+d)
				
				if not (c+d)/(a+b) <= E/100:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [a+b+c+d,c+d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F+1,100*A):
	for b in range(0,F-a+1,100*B):
		if a == 0 and b == 0:
			continue
		for c in range(0,F-a-b+1,C):
			for d in range(0,F-a-b-c+1,D):
				
				e = (c+d)/(a+b+c+d)
				
				if not e <= E/(100+E):
					continue
				
				if not a+b+c+d <= F:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [a+b+c+d,c+d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F//(100*A)+1):
	for b in range(0,(F-100*A*a)//(100*B)+1):
		if a == 0 and b == 0:
			continue
		for c in range(0,(F-100*A*a-100*B*b)//C+1):
			for d in range(0,(F-100*A*a-100*B*b-C*c)//D+1):
				
				e = (C*c+D*d)/(100*A*a+100*B*b+C*c+D*d)*100
				
				if not (C*c+D*d)/(100*A*a+100*B*b)*100 <= E/(100)*100:
					continue
				
				if not 100*A*a+100*B*b+C*c+D*d <= F:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [100*A*a+100*B*b+C*c+D*d,C*c+D*d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F//(100*A)+1):
	for b in range(0,(F-100*A*a)//(100*B)+1):
		if a == 0 and b == 0:
			continue
		
		for c in range(0,(F-100*A*a-100*B*b)//C+1):
			for d in range(0,(F-100*A*a-100*B*b-C*c)//D+1):
				
				e = (C*c+D*d)/(100*A*a+100*B*b+C*c+D*d)*100
				
				if not e <= E/(100+E)*100:
					continue
				
				if not 100*A*a+100*B*b+C*c+D*d <= F:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [100*A*a+100*B*b+C*c+D*d,C*c+D*d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F//(100*A)+1):
	for b in range(0,(F-100*A*a)//(100*B)+1):
		for c in range(0,(F-100*A*a-100*B*b)//C+1):
			for d in range(0,(F-100*A*a-100*B*b-C*c)//D+1):
				if a == 0 and b == 0 and c == 0 and d == 0:
					continue
				
				e = (C*c+D*d)/(100*A*a+100*B*b+C*c+D*d)*100
				
				if not e <= E/(100+E)*100:
					continue
				
				if not 100*A*a+100*B*b+C*c+D*d <= F:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [100*A*a+100*B*b+C*c+D*d,C*c+D*d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

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

maxE = 0
maxWS = [0,0]
for a in range(0,F//(100*A)+1):
	for b in range(0,(F-100*A*a)//(100*B)+1):
		for c in range(0,(F-100*A*a-100*B*b)//C+1):
			for d in range(0,(F-100*A*a-100*B*b-C*c)//D+1):
				if a == 0 and b == 0:
					continue
				
				if c == 0 and d == 0:
					continue
				
				e = (C*c+D*d)/(100*A*a+100*B*b+C*c+D*d)*100
				
				if not e <= E/(100+E)*100:
					continue
				
				if not 100*A*a+100*B*b+C*c+D*d <= F:
					continue
				
				if maxE < e:
					maxE = e
					maxWS = [100*A*a+100*B*b+C*c+D*d,C*c+D*d]
				
print(maxWS[0],maxWS[1])

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(1000):
    for j in range(1000):
        k = 100*i*a+100*j*b
        if 0 < k < f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(3001):
    for j in range(3001):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e//100)
    s = q[i]
    if s > w*e//100:
        s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k < f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(3001):
    for j in range(3001):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e//100)
    s = q[i]
    if s > w*e//100:
        s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k < f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(1000):
    for j in range(1000):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e//100)
    s = q[i]
    if s > w*e//100:
        s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k <= f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(1000):
    for j in range(1000):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e//100)
    s = q[i]
    if s > w*e//100:
        s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k <= f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(1000):
    for j in range(1000):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e//100)
    s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k <= f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(1000):
    for j in range(1000):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e/100+0.01)
    s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k <= f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(100):
    for j in range(100):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e/100+0.01)
    s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
a,b,c,d,e,f = LI()
ans_s = 0
ans_w = 100*a
ans = 0
l = []
for i in range(100):
    for j in range(100):
        k = 100*i*a+100*j*b
        if 0 < k <= f:
            l.append(k)
l = sorted(list(set(l)))
q = []
for i in range(100):
    for j in range(100):
        q.append(i*c+j*d)
q = sorted(list(set(q)))
for w in l:
    i = bisect.bisect_left(q,w*e/100+0.000000000001)
    s = q[i-1]
    if w+s <= f:
        if ans < s/(w+s):
            ans_w = w+s
            ans_s = s
            ans = s/(w+s)
print(ans_w,ans_s)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
def main():
    A, B, C, D, E, F = map(int, input().split())
    A *= 100
    B *= 100
    maximum = 0
    ans = (0, 0)
    for a in range(F//A+1):
        for b in range((F-A*a)//B+1):
            for c in range((F-A*a-B*b)//C+1):
                try:
                    d = min((F - A*a - B*b - C*c) // D,
                            ((A*a+B*b) * E // 100 - C*c) // D)
                    if d < 0:
                        continue
                    x = C*c + D*d
                    y = A*a + B*b + x
                    tmp = x / y
                    if tmp > maximum:
                        maximum = tmp
                        ans = (y, x)
                except ZeroDivisionError:
                    pass
    print(" ".join(map(str, ans)))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import itertools

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

def solve(a, b, c, d, e, f):
    def waters():
        xs = set()
        for i in itertools.count(0):
            if a * i * 100 > f:
                break
            for j in itertools.count(0):
                x = a * i + b * j
                if x * 100 > f:
                    break
                xs.add(x)
        return sorted(xs)
    
    def sugers():
        xs = set()
        for i in itertools.count(0):
            if c * i > f:
                break
            for j in itertools.count(0):
                x = c * i + d * j
                if x > f:
                    break
                xs.add(x)
        return sorted(xs)
    
    xs = set()
    for i in waters():
        for j in sugers():
            if i * 100 + j > f:
                break
            if j > i * e:
                break
            xs.add((i, j))
    
    def key(x):
        i, j = x
        if i + j == 0:
            return 0
        return j / (i * 100 + j)
    
    x = max(xs, key=key)

    return x[0] * 100 + x[1], x[1]

main()

Submission status: Wrong Answer

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

concent = 0
answeight = 0
anssugar = 0
for i in range( F//(100*A) + 1 ):
    for j in range( (F - 100*A*i)//B + 1 ):
        water = 100 * (A*i + B*j)
        maxsugar = min( E * (A*i + B*j), F - water )
        if 0 < water:
            for k in range( maxsugar//C + 1 ):
                sugar = C*k + D*((maxsugar - C*k)//D)
                if concent < sugar/(water + sugar):
                    concent = sugar/(water + sugar)
                    answeight = water + sugar
                    anssugar = sugar
                    

print( answeight, anssugar )