From a9ea200ec7f66324cbef6b656bacab29d2ee71f7 Mon Sep 17 00:00:00 2001 From: Ebee1205 Date: Tue, 22 Jul 2025 10:27:58 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=A1=B0=EC=9D=80=EB=B9=84]=20Day16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../860.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "leetcode2/1easy/\354\241\260\354\235\200\353\271\204/860.py" diff --git "a/leetcode2/1easy/\354\241\260\354\235\200\353\271\204/860.py" "b/leetcode2/1easy/\354\241\260\354\235\200\353\271\204/860.py" new file mode 100644 index 00000000..8657dbf3 --- /dev/null +++ "b/leetcode2/1easy/\354\241\260\354\235\200\353\271\204/860.py" @@ -0,0 +1,28 @@ +class Solution: + def lemonadeChange(self, bills: List[int]) -> bool: + # 현금 없이 레몬에이드 팔기 + f_d = 0 + t_d = 0 + + for bill in bills: + if bill == 5: + f_d += 1 + elif bill == 10: + if f_d == 0: + return False + f_d -= 1 + t_d += 1 + else: + if t_d > 0 and f_d > 0: + t_d -= 1 + f_d -= 1 + elif f_d >= 3: + f_d -= 3 + # 20$ + else: + return False + return True + + # print(f_d, t_d, bill) + + \ No newline at end of file