Skip to content

Commit

Permalink
2024-05-14
Browse files Browse the repository at this point in the history
  • Loading branch information
H0ngJu committed May 14, 2024
1 parent b1681b5 commit e15551b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
| 12차시 | 2024.04.09 | DFS | [ABCDE](https://www.acmicpc.net/problem/13023) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/180 |
| 13차시 | 2024.05.06 | 완전탐색 | [리모컨](https://www.acmicpc.net/problem/1107) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/181 |
| 14차시 | 2024.05.09 | DFS | [치킨배달](https://www.acmicpc.net/problem/15686) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/183 |
| 15차시 | 2024.05.14 | 그리디 | [A와 B](https://www.acmicpc.net/problem/12904) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/188 |

---
27 changes: 27 additions & 0 deletions H0ngJu/그리디/A와 B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys
sys.setrecursionlimit(10**6)

def input(): return sys.stdin.readline().rstrip()

S = list(input())
T = list(input())

def solution(cur, target):
if len(cur) == len(target): # len(cur) == len(target)
if cur == target:
return 1
else: return 0

elif len(cur) < len(target): # len(cur) < len(target)
if target[-1] == "A":
target.pop()
return solution(cur, target)
else:
target.pop()
target = target[::-1]
return solution(cur, target)

else: # len(cur) > len(target)
return 0

print(solution(S, T))

0 comments on commit e15551b

Please sign in to comment.