diff --git a/hadongun/README.md b/hadongun/README.md index 02d568e..1594523 100644 --- a/hadongun/README.md +++ b/hadongun/README.md @@ -19,5 +19,6 @@ | 15차시| 2025.05.21 | 트리 | [트리] (https://www.acmicpc.net/problem/1068)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/58| | 16차시| 2025.06.27 | 구현 | [킹] (https://www.acmicpc.net/problem/1063)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/68| | 17차시| 2025.07.04 | 두 포인터 | [두 수의 합] (https://www.acmicpc.net/problem/3273)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/71| - | 18차시| 2025.07.08 | 그래프 탐색 | [헌내기는 친구가 필요해] (https://www.acmicpc.net/problem/21736)|| + | 18차시| 2025.07.08 | 그래프 탐색 | [헌내기는 친구가 필요해] (https://www.acmicpc.net/problem/21736)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/75| + | 19차시| 2025.07.11 | 문자열 | [IOIOI] (https://www.acmicpc.net/problem/5525)|| --- \ No newline at end of file diff --git "a/hadongun/\353\254\270\354\236\220\354\227\264/IOIOI.py" "b/hadongun/\353\254\270\354\236\220\354\227\264/IOIOI.py" new file mode 100644 index 0000000..7c47068 --- /dev/null +++ "b/hadongun/\353\254\270\354\236\220\354\227\264/IOIOI.py" @@ -0,0 +1,31 @@ +import sys +input = sys.stdin.readline + +N = int(input()) +s_len = int(input()) +s = list(input().strip()) + +i = 0 +count = 0 + +while i < s_len - (2 * N): + if s[i] == 'I': + is_pass = True + for j in range(N): + + if s[i + 2*j + 1] != 'O': + is_pass = False + break + + if s[i + 2*j + 2] != 'I': + is_pass = False + break + if is_pass: + count += 1 + i += 2 + else: + i += 1 + else: + i += 1 + +print(count)