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())
kouho = []
for i in range(f // a + 1):
    for j in range(f // b + 1):
        water = 100 * (a * i + b + j)
        if water > f:
            break
        if water == 0:
            continue
        sugar_max = (a * i + b + j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
if kouho:
    print(kouho[0][1], kouho[0][2])
else:
    print(a, 0)

Submission status: Wrong Answer

Solution code:
inf=10**8
a,b,c,d,e,f=map(int,input().split())
a,b=100*a,100*b
DP=[inf]*(f+max(a,b)+1)
DP[a],DP[b]=0,0

for i in range(f+1):
    if DP[i]!=inf:
        DP[i+a]=DP[i]
        DP[i+b]=DP[i]
        DP[i+c]=DP[i]+c
        DP[i+d]=DP[i]+d

ans,index=0,[a,0]
for i in range(f+1):
    if DP[i]!=inf:
        if (100*DP[i]/i<=100*e/(100+e)) and (ans<100*DP[i]/i):
            ans=100*DP[i]/i
            index=[i,DP[i]]

print(*index)

Submission status: Wrong Answer

Solution code:
inf=10**8
a,b,c,d,e,f=map(int,input().split())
a,b=100*a,100*b
DP=[inf]*(f+max(a,b)+1)
DP[a],DP[b]=0,0

for i in range(f+1):
    if DP[i]!=inf:
        DP[i+a]=DP[i]
        DP[i+b]=DP[i]
        DP[i+c]=DP[i]+c
        DP[i+d]=DP[i]+d

ans,index=0,[0,0]
for i in range(f+1):
    if DP[i]!=inf:
        if (100*DP[i]/i<=100*e/(100+e)) and (ans<100*DP[i]/i):
            ans=100*DP[i]/i
            index=[i,DP[i]]

print(*index)

Submission status: Wrong Answer

Solution code:
inf=10**8
a,b,c,d,e,f=map(int,input().split())
a,b=100*a,100*b
DP=[inf]*(f+max(a,b)+1)
DP[a],DP[b]=0,0

for i in range(f+1):
    if DP[i]!=inf:
        DP[i+a]=DP[i]
        DP[i+b]=DP[i]
        for j in c,d:
            if 100*DP[i]/i<100*(DP[i]+j)/(i+j):
                DP[i+j]=DP[i]+j

ans,index=0,[0,0]
for i in range(f+1):
    if DP[i]!=inf:
        if DP[i]/i<=e/100:
            if ans<100*DP[i]/i:
                ans=100*DP[i]/i
                index=[i,DP[i]]

print(*index)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

a,b,c,d,e,f = m()

wa = [0 for i in range(f+1)]
su = [0 for i in range(f+1)]

wa[0] = 1
su[0] = 1


for i in range(f//100 + 1):
    if i*100 + a*100 <= f:
        wa[i*100 + a*100] = wa[i*100]
    if i*100 + b*100 <= f:
        wa[i*100 + b*100] = wa[i*100]

for i in range(f + 1):
    if i + c <= f:
        su[i + c] = su[i]
    if i + d <= f:
        su[i + d] = su[i]

po = [[0,a,0],[0,b,0]]

for i in range(1,f+1):
    for j in range(f+1):
        if i+j <= f and wa[i] and su[j] and i //100 * e >= j:
            po.append([(100*j)/(i+j),i+j,j])

po.sort(reverse = True)


print(po[0][1],po[0][2])

Submission status: Wrong Answer

Solution code:
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=houwa*lim//(100+houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=lim,0
for s in ss:
  for w in ws:
    if s>houwa*w or w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=houwa*lim//(100+houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
if iw!=0:
  print(100*iw+isa,isa)
else:print(100*mil1,0)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=houwa*lim//(100+houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=houwa*lim//(100+houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal as D
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=lim*houwa//100
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=D("0")
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<D(str(10000*s))/D(str(s+100*w)) and s+100*w<=lim:
      ans=D(str(10000*s))/D(str(s+100*w))
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=lim*houwa//100
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+2) for j in range(lim//(100*mi2)+2) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+2) for j in range(slim//sa2+2) if (sa1*i+sa2*j)<=slim)
ans=0
iw,isa=mi1*100,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<(10000*s)/(s+100*w) and s+100*w<=lim:
      ans=(10000*s)/(s+100*w)
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a,b,c,d,e,f = na()

p = e*100/(100+e)
a*=100
b*=100
ans = [1,0,0]

h = f//a
for i in range(h+1):
    w = (f-a*i)//b
    for j in range(w+1):
        q = f-a*i-b*j
        v = q//c
        for k in range(v+1):
            u = (q-c*k)//d
            for l in range(u+1):
                if c*k+d*l+a*i+b*j == 0:
                    continue
                n = (c*k+d*l)*100/(c*k+d*l+a*i+b*j)
                if n <= p and ans[2] < n:
                    ans = [c*k+d*l+a*i+b*j,c*k+d*l,n]

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

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a,b,c,d,e,f = na()

p = e*100/(100+e)
a*=100
b*=100
ans = [0,0,0]

h = f//a
for i in range(h+1):
    w = (f-a*i)//b
    for j in range(w+1):
        q = f-a*i-b*j
        v = q//c
        for k in range(v+1):
            u = (q-c*k)//d
            for l in range(u+1):
                if c*k+d*l+a*i+b*j == 0:
                    continue
                n = (c*k+d*l)*100/(c*k+d*l+a*i+b*j)
                if n <= p and ans[2] < n:
                    ans = [c*k+d*l+a*i+b*j,c*k+d*l,n]

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

Submission status: Wrong Answer

Solution code:
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=lim*houwa//100
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+1) for j in range(lim//(100*mi2)+1) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+1) for j in range(slim//sa2+1) if (sa1*i+sa2*j)<=slim)
ans=0
iw,isa=0,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<(10000*s)/(s+100*w) and s+100*w<=lim:
      ans=(10000*s)/(s+100*w)
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=lim*houwa//100
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+1) for j in range(lim//(100*mi2)+1) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+1) for j in range(slim//sa2+1) if (sa1*i+sa2*j)<=slim)
ans=0
iw,isa=0,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<(100*s)/(s+100*w) and s+100*w<=lim:
      ans=(100*s)/(s+100*w)
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
mi1,mi2,sa1,sa2,houwa,lim=map(int,input().split())
slim=int(lim/100*houwa)
ws=set(mi1*i+mi2*j for i in range(lim//(100*mi1)+1) for j in range(lim//(100*mi2)+1) if 100*(mi1*i+mi2*j)<=lim)
ss=set(sa1*i+sa2*j for i in range(slim//sa1+1) for j in range(slim//sa2+1) if (sa1*i+sa2*j)<=slim)
ans=0
iw,isa=0,0
for s in ss:
  for w in ws:
    if s>houwa*w or s==w==0:continue
    if ans<(100*s)/(s+100*w) and s+100*w<=lim:
      ans=(100*s)/(s+100*w)
      isa,iw=s,w
print(100*iw+isa,isa)

Submission status: Wrong Answer

Solution code:
import itertools

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

water, sugar = set(), set()
for a, b in itertools.product(range(F // (100 * A) + 1),
                              range(F // (100 * B) + 1)):
    tmp = 100 * A * a + 100 * B * b
    if 0 < tmp <= F:
        water.add(tmp)

for c, d in itertools.product(range(F // C + 1),
                              range(F // D + 1)):
    tmp = C * c + D * d
    if tmp <= F:
        sugar.add(tmp)

conc_max = 0
ans_w, ans_s = 0, 0
for w, s in itertools.product(water, sugar):
    if w + s > F or w // 100 * E < s:
        continue
    conc = 100 * s / (w + s)
    if conc > conc_max:
        conc_max = conc
        ans_w, ans_s = w + s, s
print(ans_w, ans_s)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
ans = [0, 0]
check = 0
S = set()
W = set()
for i in range(31):
    for j in range(31):
        if 100 * a * i + 100 * b * j <= f:
            W.add(100 * a * i + 100 * b * j)
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            S.add(c * i + d * j)
W = sorted(list(W))
S = sorted(list(S))
for w in W:
    for s in S:
        if w == 0:
            continue
        n = s / (w + s)
        if w + s > f or s > e * w // 100:
            break
        if n > check:
            ans = w + s, s
            check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
A = 100 * a
B = 100 * b
E = e / (100 + e)
ans = [0, 0]
check = 0
max_ab = f // max(A, B) + 1
for i in range(max_ab):
    for j in range(max_ab):
        w = A * i + B * j
        if w == 0:
            continue
        max_cd = int((w * E) // min(c, d)) + 1
        for k in range(max_cd):
            for l in range(max_cd):
                s = c * k + d * l
                n = s / (w + s)
                if w + s > f or n > E or s > e * w // 100:
                    break
                if n > check:
                    ans = w + s, s
                    check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
A = 100 * a
B = 100 * b
E = e / (100 + e)
ans = [0, 0]
check = 0
max_ab = f // max(A, B) + 1
for i in range(max_ab):
    for j in range(max_ab):
        w = A * i + B * j
        if w == 0:
            continue
        max_cd = int((w * E) // min(c, d)) + 1
        for k in range(max_cd):
            for l in range(max_cd):
                s = c * k + d * l
                n = s / (w + s)
                if w + s > f or n > E:
                    break
                if n > check:
                    ans = w + s, s
                    check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
E = e / (100 + e)
ans = [0, 0]
check = 0
S = set()
W = set()
for i in range(31):
    for j in range(31):
        if 100 * a * i + 100 * b * j <= f:
            W.add(100 * a * i + 100 * b * j)
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            S.add(c * i + d * j)
W = sorted(list(W))
S = sorted(list(S))
for w in W:
    for s in S:
        if w == 0:
            continue
        n = s / (w + s)
        if w + s > f or n > E:
            continue
        if n > check:
            ans = w + s, s
            check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
E = e / (100 + e)
ans = [0, 0]
check = 0
S = set()
W = set()
for i in range(31):
    for j in range(31):
        if 100 * a * i + 100 * b * j <= f:
            W.add(100 * a * i + 100 * b * j)
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            S.add(c * i + d * j)
W = sorted(list(W))
S = sorted(list(S))
for w in W:
    for s in S:
        if w == 0:
            continue
        n = s / (w + s)
        if w + s > f or n > E:
            break
        if n > check:
            ans = w + s, s
            check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
s = set()
w = set()
for i in range(31):
    for j in range(31):
        if 100 * a * i + 100 * b * j <= f:
            w.add(100 * a * i + 100 * b * j)
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            s.add(c * i + d * j)
w = sorted(list(w))
s = sorted(list(s))
for i in range(1, len(w)):
    for k in range(len(s)):
        n = 100 * s[k] / (w[i] + s[k])
        if w[i] + s[k] > f or n > E:
            break
        if n > check:
            ans = w[i] + s[k], s[k]
            check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
s = set()
w = set()
for i in range(31):
    for j in range(31):
        if 100 * a * i + 100 * b * j <= f:
            w.add(100 * a * i + 100 * b * j)
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            s.add(c * i + d * j)
w = sorted(list(w))
s = sorted(list(s))
for i in range(len(w)):
    for k in range(len(s)):
        if k == 0:
            continue
        n = 100 * s[k] / (w[i] + s[k])
        if E >= n > check:
            ans = w[i] + s[k], s[k]
            check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
s = set()
w = set()
for i in range(31):
    for j in range(31):
        if 100 * a * i + 100 * b * j <= f:
            w.add(100 * a * i + 100 * b * j)
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            s.add(c * i + d * j)
w = sorted(list(w))
s = sorted(list(s))
for i in range(len(w)):
    for k in range(len(s)):
        if k == 0:
            continue
        n = 100 * s[k] / (w[i] + s[k])
        if w[i] + s[k] > f or n > E:
            break
        if n > check:
            ans = w[i] + s[k], s[k]
            check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
A = 100 * a
B = 100 * b
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
s = set()
for i in range(1501):
    for j in range(1501):
        if c * i + d * j <= f:
            s.add(c * i + d * j)
s = sorted(list(s))
for i in range(31):
    for j in range(31):
        w = A * i + B * j
        if w > f:
            break
        for k in range(len(s)):
            if k == 0:
                continue
            n = 100 * s[k] / (w + s[k])
            if w + s[k] > f or n > E:
                break
            if n > check:
                ans = w + s[k], s[k]
                check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
A = 100 * a
B = 100 * b
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
for i in range(31):
    for j in range(31):
        w = A * i + B * j
        if w > f:
            break
        for k in range(int((w * E / 100) / c) + 1):
            for l in range(int((w * E / 100) / d) + 1):
                if k == 0 and l == 0:
                    continue
                s = c * k + d * l
                n = 100 * s / (w + s)
                if w + s > f or n > E:
                    break
                if n > check:
                    ans = w + s, s
                    check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
A = 100 * a
B = 100 * b
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
for i in range(f // A + 2):
    for j in range(f // B + 2):
        w = A * i + B * j
        for k in range(int((w * E / 100) // c) + 2):
            for l in range(int((w * E / 100) // d) + 2):
                if k == 0 and l == 0:
                    continue
                s = c * k + d * l
                n = 100 * s / (w + s)
                if w + s > f or n > E:
                    break
                if n > check:
                    ans = w + s, s
                    check = n
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a, b, c, d, e, f = map(int, readline().split())
A = 100 * a
B = 100 * b
E = 100 * e / (100 + e)
ans = [0, 0]
check = 0
for i in range(f // A):
    for j in range(f // B):
        w = A * i + B * j
        for k in range(int((w * E / 100) // c) + 1):
            for l in range(int((w * E / 100) // d) + 1):
                if k == 0 and l == 0:
                    continue
                s = c * k + d * l
                n = 100 * s / (w + s)
                if w + s > f or n > E:
                    break
                if n > check:
                    ans = w + s, s
                    check = n
print(*ans)

Submission status: Wrong Answer

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

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        if 100*i*a+100*j*b<=f:
            water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        if c*i+d*j<=f:
            sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
#print(sugar)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and sugar[j]<=e*(water[i]/100):
            if ans<(100*sugar[j])/(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
                #print(ans)
print(sumans,sugarans)
#print( 100*934/2634)

Submission status: Wrong Answer

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

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        if 100*i*a+100*j*b<=3000:
            water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        if c*i+d*j<=1500:
            sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
#print(sugar)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and sugar[j]<=e*(water[i]/100):
            if ans<(100*sugar[j])/(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
                #print(ans)
print(sumans,sugarans)
#print( 100*934/2634)

Submission status: Wrong Answer

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

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        if 100*i*a+100*j*b<=3000:
            water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        if c*i+d*j<=1500:
            sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
#print(sugar)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and (sugar[j]/(water[i]/100))<=e:
            if ans<(100*sugar[j])/(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
                #print(ans)
print(sumans,sugarans)
#print( 100*934/2634)

Submission status: Wrong Answer

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

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        if 100*i*a+100*j*b<=3000:
            water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        if c*i+d*j<=1500:
            sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
#print(sugar)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and (sugar[j]/(water[i]//100))<=e:
            if ans<(100*sugar[j])/(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
                #print(ans)
print(sumans,sugarans)
#print( 100*934/2634)

Submission status: Wrong Answer

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

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        if 100*i*a+100*j*b<=3000:
            water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        if c*i+d*j<=1500:
            sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
#print(sugar)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and (sugar[j]/(water[i]//100))<=e:
            if ans<(100*sugar[j])//(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
print(sumans,sugarans)

Submission status: Wrong Answer

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

water=set()#入れる可能性のある水の量O(A*B)
sugar=set()#入れる可能性のある佐藤の量O(C*D)

for i in range(31):
    for j in range(31):
        water.add(100*i*a+100*j*b)

for i in range(1501):
    for j in range(1501):
        sugar.add(c*i+d*j)
water=sorted(list(water))
#print(water)
sugar=sorted(list(sugar))
#print(sugar)
ans=0
sugarans=0
sumans=0
for i in range(1,len(water)):
    for j in range(len(sugar)):
        if water[i]+sugar[j]<=f and (sugar[j]/(water[i]//100))<=e:
            if ans<(100*sugar[j])//(water[i]+sugar[j]):
                #print(sugar[j],water[j])
                ans=(100*sugar[j])/(water[i]+sugar[j])
                sugarans=sugar[j]
                sumans=water[i]+sugar[j]
print(sumans,sugarans)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
n=F//(100*A)
m=int((F/(100+E))*E/C)
print(n,m)
a=0
b=0
c=0
for i in range(n+1):
  for j in range(n+1):
    for k in range(m+1):
      for l in range(m+1):
        if((i>0 or j>0) and (i*A+j*B)*E>=k*C+l*D and 100*(A*i+B*j)+k*C+l*D<=F):
          if((k*C+l*D)/(100*(A*i+B*j)+k*C+l*D)>=c):
            a=100*(A*i+B*j)+k*C+l*D
            b=k*C+l*D
            c=(k*C+l*D)/(100*(A*i+B*j)+k*C+l*D)
            #print(c)
print(a,b)

Submission status: Wrong Answer

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,100*a):
    for bi in range(0,f-ai+1,100*b):
        w=ai+bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
#                di=(max(0,(c31-ci-1))//d)*d
#                di=min(di,((e*w/100-ci)//d)*d)
                di=int(max(0,(min(f-w-ci-1,e*w/100-ci)//d)*d))
                indx=(ci+di)*100/w
                if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                    wmax=w+ci+di
                    indxmax=indx 
                    emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)