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())
pairs = []
for i in range(f//100):
    for j in range(f//100):
        if (100*a+c)*i+(100*b+d)*j <= f:
            pairs.append([i,j])
maxcon = [0,0,0]
for i,j in pairs:
    if (100*a*i + 100*b*j )*e >= c*i *d*j:
        con = 100*(c*i+d*j)/(100*a+c)*i+(100*b+d)*j
        if con > maxcon[0]:
            maxcon = [con,i,j]

g = (100*a+c)*maxcon[1]+(100*b+d)*maxcon[2]
s = c*maxcon[1]+d*maxcon[2]
print(g,s)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
waterset = set()
for i in range(F//(100*A)+1):
    for j in range(F//(100*B)+1):
        water = (A*i + B *j)*100
        if water < F:
            waterset.add(water)
waterset.remove(0)
sugarset = set()
for i in range(F//C + 1):
    for j in range(F//D + 1):
        sugar = C*i + D*j
        if sugar < F:
            sugarset.add(sugar)
best_conc = -1
best_a = -1
best_b = -1
for a in waterset:
    for b in sugarset:
        if a+b >F:
            continue
        if b/a * 100 > E:
            continue
        conc = 100*b/(a+b)
        if conc > best_conc:
            best_conc = conc
            best_a = a
            best_b = b
print(best_a+best_b,best_b)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
waterset = set()
for i in range(F//(100*A)+1):
    for j in range(F//(100*B)+1):
        water = (A*i + B *j)*100
        if water < F:
            waterset.add(water)
waterset.remove(0)
sugarset = set()
for i in range(F//C + 1):
    for j in range(F//D + 1):
        sugar = C*i + D*j
        if sugar < F:
            sugarset.add(sugar)
best_conc = -1
best_a = -1
best_b = -1
for a in waterset:
    for b in sugarset:
        if a+b >F:
            continue
        if b/a *100 > E:
            continue
        conc = 100*b/(a+b)
        if conc > best_conc:
            best_conc = conc
            best_a = a
            best_b = b
print(best_a+best_b,best_b)

Submission status: Wrong Answer

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

def con(w,s): return s/(w+s)

ans=0
ans_w=0
ans_s=0
for a in range(0,F+1,A):
    for b in range(0,F-a+1,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):
                if (a+b)*E/100<(c+d): break
                n=con(a+b,c+d)
                if ans<n:
                    ans=n
                    ans_w=a+b
                    ans_s=c+d

print(ans_w+ans_s,ans_s)

Submission status: Wrong Answer

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

dp=[[False for s in range(F+1)] for w in range(F+1)]
dp[0][0]=True

def c(w,s): return s/(w+s)

mw=min(A,B)
ms=min(C,D)

ans=0
ans_w=0
ans_s=0
for w in range(mw,F+1):
    for s in range(F-w+1):
        if w*E/100<s: break
        if ((A<=w and dp[w-A][s])
            or (B<=w and dp[w-B][s])
            or (C<=s and dp[w][s-C])
            or (D<=s and dp[w][s-D])):
            dp[w][s]=True
            n=c(w,s)
            if ans<n:
                ans=n
                ans_w=w
                ans_s=s

print(ans_w+ans_s,ans_s)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
#import numpy as np
mod=int(10**9+7)
inf=int(10**20)
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r):return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="number"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True

 

 
#main
A,B,C,D,E,F=map(int,input().split())
A*=100
B*=100
mizu=[]
satou=[]

for a in range(0,F+1,A):
    for b in range(0,F+1,B):
        mizu.append(a+b)
for a in range(0,F+1,C):
    for b in range(0,F+1,D):
        satou.append(a+b)

mizu.sort()
satou.sort()

ans=[0,1]

for a in satou:
    for b in mizu:
        s=a+b
        if(s==0):continue
        if(s>F):break
        if(a*100>E*b):continue
        if(a*ans[1]>ans[0]*s):
            ans=[a,s]

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
#import numpy as np
mod=int(10**9+7)
inf=int(10**20)
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r):return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="number"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True

 

 
#main
A,B,C,D,E,F=map(int,input().split())
A*=100
B*=100
mizu=[]
satou=[]

for a in range(0,F+1,A):
    for b in range(0,F+1,B):
        mizu.append(a+b)
for a in range(0,F+1,C):
    for b in range(0,F+1,D):
        satou.append(a+b)

mizu.sort()
satou.sort()

max_=[0,1]

for a in mizu:
    if(a>F):break
    for b in satou:
        if(a+b>F):break
        if(a+b==0):continue
        if b*100<=15*a:
            if (max_[0]/(sum(max_)))<b/(a+b):
                max_=[b,a]
print(sum(max_),max_[0])

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
# 作れる水の量をDPで求める (MAXはF)
# 作れる砂糖の量をDPで求める　（MAXは、F*(E/(E+100)）
# 作れる水の量に対して二分探索で、最も多く入れられる砂糖の量を求める。

dpW=[False]*(F+1)
dpW[0]=True
for w in (A*100,B*100):
  for j in range(len(dpW)):
    if dpW[j] and j+w<len(dpW):
      dpW[j+w]=True
      
water=[]
for i in range(len(dpW)):
  if dpW[i] and i!=0:
    water.append(i)

maxsugar=int(F*(E/(E+100)))+1
dpS=[False]*(maxsugar+1)
dpS[0]=True
for s in (C,D):
  for j in range(len(dpS)):
    if dpS[j] and j+s<len(dpS):
      dpS[j+s]=True
sugar=[]
for i in range(len(dpS)):
  if dpS[i]:
    sugar.append(i)

    
ans=[0,0]
maxrate=0
for w in water:
  maxS=int(w*(E/100))
  if w+maxS>F:
    maxS=F-w
  # maxSを越えない最大の砂糖をsugarから探す
  ok=0
  ng=len(sugar)
  while abs(ok-ng)>1:
    mid=abs(ok+ng)//2
    if sugar[mid]<=maxS:
      ok=mid
    else:
      ng=mid
  if sugar[ok]/w>maxrate:
    maxrate=sugar[ok]/w
    ans=[w+sugar[ok],sugar[ok]]
print(*ans)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
# 作れる水の量をDPで求める (MAXはF)
# 作れる砂糖の量をDPで求める　（MAXは、F*(E/(E+100)）
# 作れる水の量に対して二分探索で、最も多く入れられる砂糖の量を求める。

dpW=[False]*(F+1)
dpW[0]=True
for w in (A*100,B*100):
  for j in range(len(dpW)):
    if dpW[j] and j+w<len(dpW):
      dpW[j+w]=True
      
water=[]
for i in range(len(dpW)):
  if dpW[i] and i!=0:
    water.append(i)

maxsugar=int(F*(E/(E+100)))
dpS=[False]*(maxsugar+1)
dpS[0]=True
for s in (C,D):
  for j in range(len(dpS)):
    if dpS[j] and j+s<len(dpS):
      dpS[j+s]=True
sugar=[]
for i in range(len(dpS)):
  if dpS[i]:
    sugar.append(i)

    
ans=[0,0]
maxrate=0
for w in water:
  maxS=int(w*(E/100))
  if w+maxS>F:
    maxS=F-w
  # maxSを越えない最大の砂糖をsugarから探す
  ok=0
  ng=len(sugar)
  while abs(ok-ng)>1:
    mid=abs(ok+ng)//2
    if sugar[mid]<=maxS:
      ok=mid
    else:
      ng=mid
  if sugar[ok]/w>maxrate:
    maxrate=sugar[ok]/w
    ans=[w+sugar[ok],sugar[ok]]
print(*ans)

Submission status: Wrong Answer

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

w = set()
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = (A * i + B * j) * 100
        if a < F:
            w.add(a)
w.remove(0)

s = set()
for i in range(F // C + 1):
    for j in range(F // D + 1):
        b = C * i + D * j
        if b < F:
            s.add(a)
s = list(s)
s.sort()

best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    for b in s:
        if a + b > F:
            continue
        if b > E * a // 100:
            continue
        concentration = 100 * b / (a + b)
        if concentration > best_concentration:
            best_concentration = concentration
            best_a = a
            best_b = b
print(best_a + best_b, best_b)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
w = []
for i in range(f//100//a+1):
    for j in range(f//100//b+1):
        w.append(i*100*a + j*100*b)
w = set(w)
s = []
for i in range(f//c+1):
    for j in range(f//d+1):
        s.append(i*c + j*d)
s = set(s)
ans = []
for i in w:
    for j in s:
        if i != 0 and j/(i+j) <= e/(100+e) and i+j <= 3000:
            ans.append([j/(i+j), j+i, j])
ans.sort()
print(ans[-1][1], ans[-1][2])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
water = set()
sugar = set()
answer = 0.0
answer1 = [0, 0]
w, s = 0, 0
i, j = 0, 0
while w <= F:
    while w <= F:
        w = 100 * A * i + 100 * B * j
        water.add(w)
        i += 1
    j += 1

i, j = 0, 0
while s <= F:
    while s <= F:
        s = C * i + D * j
        sugar.add(s)
        i += 1
    j += 1

for i in water:
    for j in sugar:
        if i != 0:
            if E / 100 >= j / i and F >= i + j:
                if answer <= j / i:
                    answer = j / i
                    answer1 = i + j, j
                    # print('i:{0}, j:{1}'.format(i, j))


print(*answer1)

Submission status: Wrong Answer

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

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([c*C + d*D for c in range(int((E*w / 100) / C) + 1) for d in range(int((E*w / 100) / D) + 1) if ((c*C + d*D)*100 <= E*w) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] > 0 else 1)[0]
print(A if W[I] == 0 else W[I] + S[I], S[I])

Submission status: Wrong Answer

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

ans = 0
sub = [0,0]

for i in range(31):
    for g in range(31):
        water = 100*a*i+100*b*g
        if water<=f and water!=0:
            r1 = f-water
            r2 = e*water//100
            _min = min(r1,r2)
            repeat_c = _min//c
            max_sugar = 0
            for m in range(repeat_c+1):
                n=(_min-c*m)//d
                if n>=0:
                    max_sugar = max(max_sugar,c*m+d*n)
            if ans<max_sugar/(max_sugar+water):
                ans = max_sugar/(max_sugar+water)
                sub[0]=max_sugar+water
                sub[1]=max_sugar
print(*sub)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = list(map(int, input().split()))
consentration_max = 0
suger_water_max = 0
suger_max = 0
for A_cnt in range(0, 31):
    for B_cnt in range(0, 31):
        water = A_cnt * 100 * A + B_cnt * 100 * B
        if water > F or water <= 0:
            continue
        max_solt = int(E*water/100)
        for C_cnt in range(0, int(max_solt/C)+1):
            for D_cnt in range(0, max(int((max_solt - C_cnt*C)/D) + 1, 1)):
                suger = C_cnt * C + D_cnt * D
                consentration = suger/(water+suger)
                if consentration_max < consentration and (water+suger) <= F:
                    consentration_max = consentration
                    suger_water_max = water+suger
                    suger_max = suger
print("{} {}".format(suger_water_max, suger_max))

Submission status: Wrong Answer

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

X = set([])
Y = set([])

for i in range(F//(100*A)+1):
  for j in range(F//(100*B)+1):
    if 100*A*i+100*B*j <= F:
      X.add(100*A*i+100*B*j)

for i in range(F//C+1):
  for j in range(F//D+1):
    if C*i+D*j <= F:
      Y.add(C*i+D*j)
X = X - set([0])
ans = (1, 0)
for x in X:  # 水
  for y in Y:  # 塩
    if x+y <= F and y/x*100 <= E and ans[1]/ans[0] < y/(x+y):
      ans = (x+y, y)
print(*ans)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f = map(int,input().split())
A =a* 100
B =b* 100
l = []
for i in range(f//A+1):
    for j in range(f//B+1):
        if i*A+j*B <f:
            W = i*A+j*B
            s = (W//100)*e
            r = f - W
            for i in range(s//c+1):
                for j in range(s//d+1):
                    if W + i*c + j*d<=f and W>0:
                        S =i*c + j*d
                        l.append([100*S/(W+S),W+S,S])
l.sort()

l = l[::-1]
# print(l)
print(l[0][1],l[0][2])

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
W = []
S = []
for a in range(F//100+1):
    for b in range(F//100+1):
        w = A*a+B*b
        if 1 < 100*w < F:
            W.append(w)
            slist = []
            for c in range((F-100*w)//C+1):
                for d in range((F-100*w)//D+1):
                    if C*c+D*d <= F-100*w:
                        slist.append(C*c+D*d)
            S.append(slist)
maxs = []
rel = 0
for w in range(len(W)):
    for s in range(len(S[w])-1,-1,-1):
        if E*W[w] >= S[w][s]:
            if rel < 100*S[w][s]/(W[w]+S[w][s]):
                maxs = [100*W[w]+S[w][s],S[w][s]]
                rel = 100*S[w][s]/(W[w]+S[w][s])
print(*maxs)

Submission status: Wrong Answer

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

# x = 100A, 100B  , y = C, Dが与えられたとき
# x + y <= F を満たす(x, y)の組み合わせを求める。
X = []
Y = []
print(F // 100)
for x in range(1, (F // 100) + 1):
    for y in range(1, F-100*x + 1):
        if 100*x + y <= F:
            if (100*x % A == 0 or 100*x % B == 0) and (y % C == 0 or y % D == 0):
                X.append(100*x)
                Y.append(y)
# print(X, Y)
# (100y/(100+y) <= (100E/(100+E))が成り立つときtrue
for i in range(len(X)):
    if (Y[i]/(100+Y[i])) <= (E/(100+E)):
        print(X[i] + Y[i], Y[i])

Submission status: Wrong Answer

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

# x = 100A, 100B  , y = C, Dが与えられたとき
# x + y <= F を満たす(x, y)の組み合わせを求める。
X = []
Y = []
print(F // 100)
for x in range(1, (F // 100) + 1):
    for y in range(1, F-100*x):
        if 100*x + y <= F:
            if (100*x % A == 0 or 100*x % B == 0) and (y % C == 0 or y % D == 0):
                X.append(100*x)
                Y.append(y)
# print(X, Y)
# (100y/(100+y) <= (100E/(100+E))が成り立つときtrue
for i in range(len(X)):
    if (Y[i]/(100+Y[i])) <= (E/(100+E)):
        print(X[i] + Y[i], Y[i])

Submission status: Wrong Answer

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

# x = 100A, 100B  , y = C, Dが与えられたとき
# x + y <= F を満たす(x, y)の組み合わせを求める。
X = []
Y = []
for x in range(1, F+1):
    for y in range(1, F-100*x+1):
        if (100*x % A == 0 or 100*x % B == 0) and (y % C == 0 or y % D == 0):
            X.append(100*x)
            Y.append(y)
# print(X, Y)
# (100y/(100+y) <= (100E/(100+E))が成り立つときtrue
for i in range(len(X)):
    if (Y[i]/(100+Y[i])) <= (E/(100+E)):
        print(X[i] + Y[i], Y[i])
        break

Submission status: Wrong Answer

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

# x = 100A, 100B  , y = C, Dが与えられたとき
# x + y <= F を満たす(x, y)の組み合わせを求める。
X = []
Y = []
for x in range(1, B+1):
    for y in range(1, F-100*x+1):
        if 100*x + y <= F:
            if (100*x % A == 0 or 100*x % B == 0) and (y % C == 0 or y % D == 0):
                X.append(100*x)
                Y.append(y)
            # X.append(100*x if 100*x % A == 0 or 100*x % B == 0)
            # Y.append(100*y if 100*y % A == 0 or 100*y % B == 0)
# print(X, Y)
# (100y/(100+y) <= (100E/(100+E))が成り立つときtrue
for i in range(len(X)):
    if (Y[i]/(100+Y[i])) <= (E/(100+E)):
        print(X[i] + Y[i], Y[i])
        break

Submission status: Wrong Answer

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

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([c*C + d*D for c in range(int((E*w / 100) / C) + 1) for d in range(int((E*w / 100) / D) + 1) if ((c*C + d*D)*100 <= E*w) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] > 0 else 1)[0]
print(W[I] + S[I], S[I])

Submission status: Wrong Answer

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

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([c*C + d*D for c in range((E*w // 100 + 1) // C + 1) for d in range((E*w // 100 + 1) // D + 1) if (c*C + d*D <= E*w // 100) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] > 0 else 1)[0]
print(W[I] + S[I], S[I])

Submission status: Wrong Answer

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

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([c*C + d*D for c in range((E*w // 100) // C + 1) for d in range((E*w // 100) // D + 1) if (c*C + d*D <= E*w // 100) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] + S[i] > 0 else 1)[0]
print(W[I] + S[I], S[I])

Submission status: Wrong Answer

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

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([0] + [c*C + d*D for c in range((E*w // 100) // C + 1) for d in range((E*w // 100) // D + 1) if (c*C + d*D <= E*w // 100) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] > 0 else 1)[0]
print(W[I] + S[I], S[I])

Submission status: Wrong Answer

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

W = sorted(list({a*100*A + b*100*B for a in range(F // 100 // A + 1) for b in range(F // 100 // B + 1) if a*100*A + b*100*B <= F}))
S = [max([c*C + d*D for c in range((E*w // 100) // C + 1) for d in range((E*w // 100) // D + 1) if (c*C + d*D <= E*w // 100) and (c*C + d*D + w <= F)]) for w in W]
I = sorted([i for i in range(len(W))], key=lambda i : W[i]/(W[i] + S[i]) if W[i] > 0 else 1)[0]
print(W[I] + S[I], S[I])

Submission status: Wrong Answer

Solution code:

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

density = 0
ans = (0, 0)

for a in range(31):
  for b in range(31):
    for c in range(101):
      for d in range(101):
        water = 100*a*A + 100*b*B
        suger = c*C + d*D
         
        if water + suger > F or water == 0:
          break

        if (water / 100) * E >= suger:
        
          tmp = (100 * suger)  / (water + suger)

          if tmp > density:
            density = tmp
            ans = (water+suger, suger)

print(*ans)

Submission status: Wrong Answer

Solution code:

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

density = 0
ans = (0, 0)

for a in range(31//A+1):
  for b in range(31//B+1):
    for c in range(101):
      for d in range(101):
        water = 100*a*A + 100*b*B
        suger = c*C + d*D
         
        if water + suger > F or water == 0:
          break

        if suger > 0 and (suger / water * 100)  > E:
          continue
        
        tmp = (100 * suger)  / (water + suger)

        if tmp > density:
          density = tmp
          ans = (water+suger, suger)

print(*ans)

Submission status: Wrong Answer

Solution code:

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

density = 0
ans = (0, 0)

for a in range(31//A+1):
  for b in range(31//B+1):
    for c in range(101):
      for d in range(101):
        water = 100*a*A + 100*b*B
        suger = c*C + d*D
         
        if water + suger > F or water == 0:
          break

        if suger > 0 and (suger / water * 100)  > E:
          continue
        
        tmp = (100 * suger)  / (water + suger)

        if tmp >= density:
          density = tmp
          ans = (water+suger, suger)

print(*ans)

Submission status: Wrong Answer

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

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = w*E
    if ans[0] == 0:
        ans[0] = water
    st = 0
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,0,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if st == 1 and s+water <= F and s/(s+water) > per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))

Submission status: Wrong Answer

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

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = w*E
    if ans[0] == 0:
        ans[0] = water
    
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,0,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if st == 1 and s+water <= F and s/(s+water) > per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))

Submission status: Wrong Answer

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

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = w*E
    if ans[0] == 0:
        ans[0] = water
    
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,0,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if st == 1 and s+water <= F and s/(s+water) >= per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))

Submission status: Wrong Answer

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

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = w*E
    if ans[0] == 0:
        ans[0] = water
    
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,-1,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if s+water <= F and s/(s+water) >= per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))

Submission status: Wrong Answer

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

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = w*E
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,-1,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if s+water <= F and s/(s+water) >= per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))

Submission status: Wrong Answer

Solution code:

A,B,C,D,E,F = map(int,input().split(' '))
ans = [0,0]
r = 0
for i in range(F//A+1):
    for j in range(F//B+1):
        if (i == 0 and j == 0) or  100*(A*i+B*j) > F:
            break
        for k in range(F//C+1):
            for f in range(F//D+1):
                tmp = 100*A*i+100*B*j+C*k+E*f
                r_tmp = 100*(C*k+D*f)/tmp
                if tmp > F:
                    break
                if r <= r_tmp<=100*E/(100+E):
                    r = r_tmp
                    ans = [tmp,C*k+D*f]
print(ans[0],ans[1])

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = (100 * A, 0)
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        if i == 0 and j == 0:
            continue
        x = 100 * (A * i + B * j)
        loop = (A * i + B * j)
        if F < x:
            continue
        for k in range(loop * E // C + 1):
            for l in range(loop * E // D + 1):
                y = C * k + D * l
                if (A * i + B * j) * E < y:
                    continue
                if x + y <= F and max_con < y / (x + y):
                    max_con = y / (x + y)
                    res = (x + y, y)
                    print(x + y, y)
print(*res)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = (100, 0)
for i in range(31):
    for j in range(31):
        for k in range(31):
            for l in range(31):
                x = 100 * A * i + 100 * B * j
                y = C * k + D * l
                if x + y != 0 and x + y <= F and y <= (x // 100) * E \
                        and max_con < y / (x + y):
                    max_con = y / (x + y)
                    res = (x + y, y)
                    # print(x + y, y)
print(*res)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = tuple(map(int, input().split()))
max_con = 0
res = (0, 0)
for i in range(31):
    for j in range(31):
        for k in range(31):
            for l in range(31):
                x = 100 * A * i + 100 * B * j
                y = C * k + D * l
                if x + y != 0 and x + y <= F and y <= (x // 100) * E \
                        and max_con < y / (x + y):
                    max_con = y / (x + y)
                    res = (x + y, y)
                    # print(x + y, y)
print(*res)