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())
water=[]
for i in range(F//(100*B)+1):
  for j in range((F-100*B*i)//(100*A)+1):
    water.append(100*A*j+100*B*i)
water=sorted(list(set(water)))
suger=[]
for i in range(F//(C)+1):
  for j in range((F-C*i)//D+1):
    suger.append(C*j+D*i)
suger=sorted(list(set(suger)))
Water=0
Suger=0
ans=0
if (A*100+min(C,D)>F):
  print(A*100,0)
else:
  for i in range(len(water)):
    for j in range(len(suger)):
      if i==0:
        break
      if water[i]+suger[j]>F:
        break
      c=float(suger[j]*100/water[i])
      if c<=E:
        if c>ans:
          ans=c
          Water=water[i]+suger[j]
          Suger=suger[j]
  print(Water,Suger)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
water=[]
for i in range(F//(100*B)+1):
  for j in range((F-100*B*i)//(100*A)+1):
    water.append(100*A*j+100*B*i)
water=sorted(list(set(water)))
suger=[]
for i in range(F//(C)+1):
  for j in range((F-C*i)//D+1):
    suger.append(C*j+D*i)
suger=sorted(list(set(suger)))
Water=0
Suger=0
ans=0
for i in range(len(water)):
  for j in range(len(suger)):
    if i==0:
      break
    if water[i]+suger[j]>F:
      break
    c=float(suger[j]*100/water[i])
    if c<=E:
      if c>ans:
        ans=c
        Water=water[i]+suger[j]
        Suger=suger[j]
print(Water,Suger)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def map_int():
        return [int(x) for x in Scanner.string().split()]
    def string_list(n):
        return [input() for i in range(n)]
    def int_list_list(n):
        return [Scanner.mapInt() for i in range(n)]
    def int_cols_list(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    A,B,C,D,E,F = Scanner.map_int()
    n,m = 0,0
    M = 0
    for a in range(40):
        for b in range(40):
            w = A * a * 100 + B * b * 100
            if w == 0:
                continue
            if w > F:
                continue
            for c in range(40):
                for d in range(40):
                    s = c * C + d * D
                    mass = w + s
                    if s == 0:
                        continue
                    if mass > F:
                        continue
                    if s * 100 > E * w:
                        continue
                    if M <= 100 * s / mass:
                        M = 100 * s / mass
                        n,m = mass,s

    print(n,m)
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def map_int():
        return [int(x) for x in Scanner.string().split()]
    def string_list(n):
        return [input() for i in range(n)]
    def int_list_list(n):
        return [Scanner.mapInt() for i in range(n)]
    def int_cols_list(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    A,B,C,D,E,F = Scanner.map_int()
    n,m = 0,0
    M = 0
    for a in range(40):
        for b in range(40):
            w = A * a * 100 + B * b * 100
            if w == 0:
                continue
            if w > F:
                continue
            for c in range(40):
                for d in range(40):
                    s = c * C + d * D
                    if s == 0:
                        continue
                    if w + s > F:
                        continue
                    if s * 100 > E * w:
                        continue
                    if M < (100 * s) / (w + s):
                        M = (100 * s) / (w + s)
                        n,m = w + s,s

    print(n,m)
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def map_int():
        return [int(x) for x in Scanner.string().split()]
    def string_list(n):
        return [input() for i in range(n)]
    def int_list_list(n):
        return [Scanner.mapInt() for i in range(n)]
    def int_cols_list(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    A,B,C,D,E,F = Scanner.map_int()
    n,m = 0,0
    M = 0
    for a in range((F // 100) // A + 1):
        for b in range((F // 100) // B + 1):
            w = A * a * 100 + B * b * 100
            if w == 0:
                continue
            if w > F:
                continue
            for c in range(F // C + 1):
                for d in range(F // D + 1):
                    s = c * C + d * D
                    if w + s > F:
                        continue
                    if s > E * w / 100:
                        continue
                    if M < (100 * s) / (w + s):
                        M = (100 * s) / (w + s)
                        n,m = w + s,s

    print(n,m)
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def map_int():
        return [int(x) for x in Scanner.string().split()]
    def string_list(n):
        return [input() for i in range(n)]
    def int_list_list(n):
        return [Scanner.mapInt() for i in range(n)]
    def int_cols_list(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    A,B,C,D,E,F = Scanner.map_int()
    n,m = 0,0
    M = 0
    for a in range(F // 100 + 1):
        for b in range(F // 100 + 1):
            w = A * a * 100 + B * b * 100
            if w == 0:
                continue
            if w > F:
                continue
            for c in range(E + 1):
                for d in range(E + 1):
                    s = c * C + d * D
                    if s == 0:
                        continue
                    if w + s > F:
                        continue
                    if s > E * w / 100:
                        continue
                    if M < (100 * s) / (w + s):
                        M = (100 * s) / (w + s)
                        n,m = w + s,s
    print(n,m)
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class Scanner():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def map_int():
        return [int(x) for x in Scanner.string().split()]
    def string_list(n):
        return [input() for i in range(n)]
    def int_list_list(n):
        return [Scanner.mapInt() for i in range(n)]
    def int_cols_list(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    A,B,C,D,E,F = Scanner.map_int()
    n,m = 0,0
    M = 0
    for a in range(F // 100):
        for b in range(F // 100):
            w = A * a * 100 + B * b * 100
            if w == 0:
                continue
            if w > F:
                continue
            for c in range(E):
                for d in range(E):
                    s = c * C + d * D
                    if s == 0:
                        continue
                    if w + s > F:
                        continue
                    if s > E * w / 100:
                        continue
                    if M < 100 * s / (w + s):
                        M = 100 * s / (w + s)
                        n,m = w + s,s


    print(n,m)
    return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,c,d,e,f = inpl()
water = set()
sugar = set()
for i in range(f//(a*100)+10):
    for j in range(f//(b*100)+10):
        w = a*100*i + b*100*j
        if w > f:
            break
        water.add(w)
for i in range(f//c+10):
    for j in range(f//d+10):
        s = c*i + d*j
        if s > f:
            break
        sugar.add(s)
water = sorted(list(water))
sugar = sorted(list(sugar))
# print(water)
# print(sugar)

max_cons = 0
res_to = 0
res_s = 0
for w in water:
    for s in sugar:
        if w+s > f:
            break
        if w == 0 and s == 0:
            continue
        cons = s/(w+s)
        # print(w,s)
        if cons > e/(100+e):
            continue
        if cons > max_cons:
            res_to = w+s
            res_s = s
            max_cons = cons
print(res_to,res_s)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,c,d,e,f = inpl()
water = set()
sugar = set()
for i in range(f//(a*100)+1):
    for j in range(f//(b*100)+1):
        w = a*100*i + b*100*j
        if w > f:
            break
        water.add(w)
for i in range(f//c+1):
    for j in range(f//d+1):
        s = c*i + d*j
        if s > f:
            break
        sugar.add(s)
water = sorted(list(water))
sugar = sorted(list(sugar))
# print(water)
# print(sugar)

max_cons = 0
res_to = 0
res_s = 0
for w in water:
    for s in sugar:
        if w+s > f:
            break
        if w == 0 and s == 0:
            continue
        cons = s/(w+s)
        # print(w,s)
        if (100+e)*s > (w+s)*e:
            continue
        if cons > max_cons:
            res_to = w+s
            res_s = s
            max_cons = cons
print(res_to,res_s)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,c,d,e,f = inpl()
water = set()
sugar = set()
for i in range(f//(a*100)+1):
    for j in range(f//(b*100)+1):
        w = a*100*i + b*100*j
        if w > f:
            break
        water.add(w)
for i in range(f//c+1):
    for j in range(f//d+1):
        s = c*i + d*j
        if s > f:
            break
        sugar.add(s)
water = sorted(list(water))
sugar = sorted(list(sugar))
# print(water)
# print(sugar)

max_cons = 0
res_to = 0
res_s = 0
for w in water:
    for s in sugar:
        if w+s >= f:
            break
        if w == 0 or s == 0:
            continue
        cons = s/(w+s)
        # print(w,s)
        if (100+e)*s > (w+s)*e:
            continue
        if cons > max_cons:
            res_to = w+s
            res_s = s
            max_cons = cons
print(res_to,res_s)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,d,e,f=LI()
  ans_n=-inf
  ans_pair=[0,0]
  ans_debug=[0,0,0,0]

  z=100*e/(100+e)
  # print(z)
  
  for i in range(1,31):
    for j in range(1,31):
      for k in range(1,3001):
        for l in range(1,3001):
          a=i*100+j*100
          b=k*c+l*d

          if a+b>f:
            break

          if a+b==0:
            break

          y=100*b/(a+b)
          if y<z:
            if ans_n<y:
              ans_n=y
              ans_pair=[a+b,b]
              ans_debug=[i,j,k,l]

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,d,e,f=LI()
  ans_n=-inf
  ans_pair=[0,0]
  ans_debug=[0,0,0,0]

  z=100*e/(100+e)
  # print(z)
  
  for i in range(1,31):
    for j in range(1,31):
      for k in range(1,3001):
        for l in range(1,3001):
          a=i*100+j*100
          b=k*c+l*d

          if a+b>f:
            break

          if a+b==0:
            break

          y=100*b/(a+b)
          if y<=z:
            if ans_n<y:
              ans_n=y
              ans_pair=[a+b,b]
              ans_debug=[i,j,k,l]

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,d,e,f=LI()
  ans_n=-inf
  ans_pair=[0,0]

  z=100*e/(100+e)
  # print(z)
  
  for i in range(31):
    for j in range(31):
      for k in range(3001):
        for l in range(3001):
          a=i*100+j*100
          b=k*c+l*d

          if a+b>f:
            break

          if a+b==0:
            break

          y=100*b/(a+b)
          if y<=z:
            if ans_n<y:
              ans_n=y
              ans_pair=[a+b,b]

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,d,e,f=LI()
  ans_n=-inf
  ans_pair=[0,0]

  z=100*e/(100+e)
  
  for i in range(31):
    for j in range(31):
      for k in range(3001):
        for l in range(3001):
          a=i*100+j*100
          b=k*c+l*d

          if a+b>f:
            break

          if a+b==0:
            break

          y=100*b/(a+b)
          if y<z:
            if ans_n<y:
              ans_n=y
              ans_pair=[a+b,b]

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,d,e,f=LI()
  ans_n=-inf
  ans_pair=[0,0]

  z=100*e/(100+e)
  
  for i in range(31):
    for j in range(31):
      for k in range(3001):
        for l in range(3001):
          a=i*100+j*100
          b=k+l

          if a+b>f:
            break

          if a+b==0:
            break

          y=100*b/(a+b)
          if y<z:
            if ans_n<z:
              ans_n=z
              ans_pair=[a+b,b]

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
wl=set()
i=0
while i*100*a<=f:
    j=0
    while i*100*a+j*100*a<=f:
        wl.add(i*100*a+j*100*a)
        j+=1
    i+=1
sl=set()
i=0
while i*c<=f:
    j=0
    while i*c+j*d<=f:
        sl.add(i*c+j*d)
        j+=1
    i+=1
max=0
x=0
y=0
for w in wl:
    if w==0:
        continue
    for s in sl:
        if w//100*e>=s and w+s<=f:
            if x==0 and y==0:
                x=w
                y=s
            if max<s/w+s:
                max=s/w+s
                x=w+s
                y=s
print(x,y)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f=map(int,input().split())
wl=set()
i=0
while i*100*a<=f:
    j=0
    while i*100*a+j*100*a<=f:
        wl.add(i*100*a+j*100*a)
        j+=1
    i+=1
sl=set()
i=0
while i*c<=f:
    j=0
    while i*c+j*d<=f:
        sl.add(i*c+j*d)
        j+=1
    i+=1
max=x=y=0
for w in wl:
    if w==0:
        continue
    for s in sl:
        if s==0:
            continue
        if w//100*e>=s and w+s<=f:
            if max<s/w+s:
                max=s/w+s
                x=w+s
                y=s
print(x,y)

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0.0
    x=0
    y=0
    for i in range(f//b+1):
        for j in range((f-(i*b))//a+1):
            for k in range((f-(i*b+j*a))//d+1):
                for l in range((f-(i*b+j*a+k*d))//c+1):
                    if i*b+j*a>0 and f>=i*b+j*a+k*d+l*c and (k*d+l*c)/(i*b+j*a) <= e/100 and den < (k*d+l*c)/(i*b+j*a):
                        den=(k*d+l*c)/(i*b+j*a)
                        x=i*b+j*a+k*d+l*c
                        y=k*d+l*c
    print(x,y)                  
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0.0
    x=0
    y=0
    for i in range(f//b+1):
        for j in range((f-(i*b))//a+1):
            for k in range((f-(i*b+j*a))//d+1):
                for l in range((f-(i*b+j*a+k*d))//c+1):
                    if i*b+j*a>0 and f>=i*b+j*a+k*d+l*c and (k*d+l*c)/(i*b+j*a) < e/100 and den < (k*d+l*c)/(i*b+j*a):
                        den=(k*d+l*c)/(i*b+j*a)
                        x=i*b+j*a+k*d+l*c
                        y=k*d+l*c
    print(x,y)                  
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0.0
    ans=[0,0]
    for i in range(f//b+1):
        for j in range((f-(i*b))//a+1):
            water = i*b + j*a
            sm=f-water
            for k in range(sm//d+1):
                for l in range((sm-k*d)//c+1):
                    sugar = k*d + l*c
                    if water+sugar<=f and water>0 and e/100 >= (sugar/water) and den < (sugar/water):
                        den = sugar/water
                        ans = [sugar+water,sugar]
    print(int(ans[0]),int(ans[1]))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for i in range(f//b+1):
        for j in range((f-(i*b))//a+1):
            water = i*b + j*a
            if water>f:
                continue
            sm=f-water
            for k in range(sm//d+1):
                for l in range((sm-k*d)//c+1):
                    sugar = k*d + l*c
                    if water+sugar>f:
                        continue
                    if water>0 and e/100 >= (sugar/water) and den < (sugar/water):
                        den = sugar/water
                        ans = [sugar+water,sugar]
    print(int(ans[0]),int(ans[1]))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0
    den_max = (e) / (100+e)
    ans=[0,0]
    for i in range(f//b+2):
        for j in range((f-(i*b))//a+2):
            water = i*b + j*a
            if water>f:
                break
            sm=f-water
            for k in range(sm//d+2):
                for l in range((sm-k*d)//c+2):
                    sugar = k*d + l*c
                    if water+sugar>f:
                        break
                    if water>0 and den_max >= ((sugar)/(water+sugar)) and den < ((sugar)/(water+sugar)):
                        den = (sugar)/(water+sugar)
                        ans = [sugar+water,sugar]
    print(int(ans[0]),int(ans[1]))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for i in range(f//b+1):
        for j in range((f-(i*b))//a+1):
            water = i*b + j*a
            if water>f:
                break
            sm=int((water*e)/100)
            for k in range(sm//d+1):
                for l in range((sm-k*d)//c+1):
                    sugar = k*d + l*c
                    if water+sugar>f:
                        break
                    if water>0 and den<(sugar)/(water+sugar):
                        den=(sugar)/(water+sugar)
                        ans=[sugar+water,sugar]
    print(ans[0],ans[1])



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    water=f
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for i in range(int(water//b)+1):
        w=int(b*i+((water-b*i)//a)*a)
        sugar=(w*e)/100
        for j in range(int(sugar//d)+1):
            s=int(d*j+((sugar-d*j)//c)*c)
            if w!=0 and den < ((s)/(w+s)) and w+s<=f:
                den = (s)/(w+s)
                ans[0]=w+s
                ans[1]=s

    print(ans[0],ans[1])
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    water= ( ( (100*f)/(100+e) ) //100 )*100
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for i in range(int(water//b)+1):
        w=int(b*i+((water-b*i)//a)*a)
        sugar=(w*e)/100
        for j in range(int(sugar//d)+1):
            s=int(d*j+((sugar-d*j)//c)*c)
            if w!=0 and den < ((s)/(w+s)) and w+s<=f:
                den = (s)/(w+s)
                ans[0]=w+s
                ans[1]=s

    print(ans[0],ans[1])
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d,e,f = map(int,input().split())
    water= ( ( (100*f)/(100+e) ) //100 )*100
    a*=100
    b*=100
    den=0
    ans=[0,0]
    for i in range(int(water//b)+1):
        w=int(b*i+((water-b*i)//a)*a)
        sugar=(w*e)/100
        for j in range(int(sugar//d)+1):
            s=int(d*j+((sugar-d*j)//c)*c)
            if w!=0 and den<(s)/(w+s):
                den=(s)/(w+s)
                ans[0]=w+s
                ans[1]=s

    print(ans[0],ans[1])
if __name__ == "__main__":
    main()