Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://inf-ege.sdamgia.ru/problem?id=33771
- data = open('26.txt').readlines()
- n, s = map(int, data[0].split())
- a = []
- for i in range(1, n + 1):
- cost, cnt, l = data[i].split()
- cost = int(cost)
- cnt = int(cnt)
- if l == 'A':
- a.append(('b', cost, cnt))
- else:
- a.append(('a', cost, cnt))
- a.sort()
- answ = 0
- for e in a:
- if e[0] == 'b':
- answ += min(e[2], s // e[1])
- s -= e[1] * min(e[2], s // e[1])
- print(answ, s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement