diff --git "a/choieungi/NewThisIsCT/13_19 \354\227\260\354\202\260\354\236\220 \353\201\274\354\233\214 \353\204\243\352\270\260.py" "b/choieungi/NewThisIsCT/13_19 \354\227\260\354\202\260\354\236\220 \353\201\274\354\233\214 \353\204\243\352\270\260.py" new file mode 100644 index 0000000..57f45f7 --- /dev/null +++ "b/choieungi/NewThisIsCT/13_19 \354\227\260\354\202\260\354\236\220 \353\201\274\354\233\214 \353\204\243\352\270\260.py" @@ -0,0 +1,42 @@ +import sys +from collections import deque + +n = int(input()) +data = list(map(int, input().split())) +add, sub, mal, div = map(int, input().split()) + +min_val = sys.maxsize +max_val = -sys.maxsize + +def dfs(i, data, now): + global min_val, max_val, add, sub, mal, div + + if i == n : + min_val = min(min_val, now) + max_val = max(max_val, now) + + else: + if add > 0: + add -= 1 + dfs(i+1, data, now + data[i]) + add += 1 + + if sub > 0: + sub -= 1 + dfs(i + 1, data, now - data[i]) + sub += 1 + + if mal > 0: + mal -= 1 + dfs(i + 1, data, now * data[i]) + mal += 1 + + if div > 0: + div -= 1 + dfs(i + 1, data, int(now / data[i])) + div += 1 + +dfs(1, data, data[0]) + +print(max_val) +print(min_val) \ No newline at end of file