From 4709e090a64482afd41695a2cadd2c88e43841c8 Mon Sep 17 00:00:00 2001 From: keunho Date: Sat, 28 Sep 2024 17:43:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?2024-09-28=20=ED=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kokeunho/README.md | 2 +- .../\352\265\254\355\230\204/1-kokeunho.py" | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 "kokeunho/\352\265\254\355\230\204/1-kokeunho.py" diff --git a/kokeunho/README.md b/kokeunho/README.md index 9b095df..0aa548a 100644 --- a/kokeunho/README.md +++ b/kokeunho/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.10.01 | 구현 | [추억 점수](https://school.programmers.co.kr/learn/courses/30/lessons/176963)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/35| +| 1차시 | 2024.09.28 | 구현 | [킹](https://www.acmicpc.net/problem/1063) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/1) | --- diff --git "a/kokeunho/\352\265\254\355\230\204/1-kokeunho.py" "b/kokeunho/\352\265\254\355\230\204/1-kokeunho.py" new file mode 100644 index 0000000..da91ed9 --- /dev/null +++ "b/kokeunho/\352\265\254\355\230\204/1-kokeunho.py" @@ -0,0 +1,39 @@ +king, rock, m_time = input().split() +m_time = int(m_time) +move = [input() for _ in range(m_time)] + +king_x = int(ord(king[0])) - int(ord('A')) + 1 +king_y = int(king[1]) + +rock_x = int(ord(rock[0])) - int(ord('A')) + 1 +rock_y = int(rock[1]) + +move_way = ['R', 'L', 'T', 'B', 'RT', 'RB', 'LT', 'LB'] +dx = [1, -1, 0, 0, 1, 1, -1, -1] +dy = [0, 0, 1, -1, 1, -1, 1, -1] + +for i in range(m_time): + index = move_way.index(move[i]) + + after_king_x = king_x + dx[index] + after_king_y = king_y + dy[index] + + if 0 < after_king_x <= 8 and 0 < after_king_y <= 8: + if after_king_x == rock_x and after_king_y == rock_y: + after_rock_x = rock_x + dx[index] + after_rock_y = rock_y + dy[index] + if 0 < after_rock_x <= 8 and 0 < after_rock_y <= 8: + king_x = after_king_x + king_y = after_king_y + rock_x = after_rock_x + rock_y = after_rock_y + else: + king_x = after_king_x + king_y = after_king_y + +print(f'{chr(king_x + 64)}{king_y}') +print(f'{chr(rock_x + 64)}{rock_y}') + + + + From db21270bbdaeba8470d7e93e88dd30dff975c9a1 Mon Sep 17 00:00:00 2001 From: kokeunho <95072015+kokeunho@users.noreply.github.com> Date: Sun, 29 Sep 2024 14:01:02 +0900 Subject: [PATCH 2/2] Update README.md --- kokeunho/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kokeunho/README.md b/kokeunho/README.md index 0aa548a..ccb5b66 100644 --- a/kokeunho/README.md +++ b/kokeunho/README.md @@ -2,5 +2,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.09.28 | 구현 | [킹](https://www.acmicpc.net/problem/1063) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/1) | +| 1차시 | 2024.09.28 | 구현 | [킹](https://www.acmicpc.net/problem/1063) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/1) | ---