Skip to content

Commit

Permalink
2024-06-24
Browse files Browse the repository at this point in the history
  • Loading branch information
ha2hi committed Jun 24, 2024
1 parent d2b49d4 commit 1b809bb
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 코딩테스트/baekjoon/Implementation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 다시 봐야되는 문제
1. 배열 돌리기
2. 배열 돌리기1
66 changes: 66 additions & 0 deletions 코딩테스트/baekjoon/Implementation/ZOAC.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A\n",
"AI\n",
"AIK\n",
"ALIK\n",
"ALINK\n",
"ARLINK\n",
"SARLINK\n",
"SARTLINK\n"
]
}
],
"source": [
"from collections import defaultdict\n",
"s = input()\n",
"res = [''] * len(s)\n",
"tmp = dict()\n",
"\n",
"for i, v in enumerate(s):\n",
" tmp[v] = i\n",
"\n",
"for key, value in sorted(tmp.items()):\n",
" res[value] = key\n",
" print(''.join(res))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
86 changes: 86 additions & 0 deletions 코딩테스트/baekjoon/Implementation/배열돌리기1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3 4 8 12\n",
"2 11 10 16\n",
"1 7 6 15\n",
"5 9 13 14\n"
]
}
],
"source": [
"# https://www.acmicpc.net/problem/16926\n",
"from collections import deque\n",
"n, m, r = map(int, input().split())\n",
"board = [list(map(int, input().split())) for _ in range(n)]\n",
"q = deque()\n",
"answer = [[0] * m for _ in range(n)]\n",
"\n",
"loops = min(n,m) // 2\n",
"for i in range(loops):\n",
" q.clear()\n",
" q.extend(board[i][i:m-i]) # 위\n",
" q.extend([row[m-i-1] for row in board[i+1:n-i-1]]) # 오른쪽\n",
" q.extend(board[n-i-1][i:m-i][::-1]) # 아래\n",
" q.extend([row[i] for row in board[i+1:n-i-1][::-1]]) # 왼쪽\n",
"\n",
" q.rotate(-r)\n",
"\n",
" for j in range(i, m-i): # 위\n",
" answer[i][j] = q.popleft() \n",
" for j in range(i+1, n-i-1): # 오른쪽\n",
" answer[j][m-i-1] = q.popleft()\n",
" for j in range(m-i-1, i-1, -1): # 아래\n",
" answer[n-i-1][j] = q.popleft()\n",
" for j in range(n-i-2, i, -1): # 왼쪽\n",
" answer[j][i] = q.popleft()\n",
"\n",
"for row in answer:\n",
" print(*row)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Empty file.
99 changes: 99 additions & 0 deletions 코딩테스트/baekjoon/Implementation/오목.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"3 2\n"
]
},
{
"ename": "SystemExit",
"evalue": "0",
"output_type": "error",
"traceback": [
"An exception has occurred, use %tb to see the full traceback.\n",
"\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m 0\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/mzc01-hyucksangcho/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3452: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
" warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
]
}
],
"source": [
"# https://www.acmicpc.net/problem/2615\n",
"import sys\n",
"board = [list(map(int, input().split())) for _ in range(19)]\n",
"\n",
"dx = [-1, 0, 1,1]\n",
"dy = [1, 1,1,0]\n",
"for i in range(19):\n",
" for j in range(19):\n",
" if board[i][j] == 1 or board[i][j] == 2:\n",
" v = board[i][j]\n",
"\n",
" for k in range(4):\n",
" cnt = 1\n",
" xx = i + dx[k]\n",
" yy = j + dy[k]\n",
" \n",
" while 0<=xx<19 and 0<=yy<19 and board[xx][yy] == v:\n",
" cnt += 1\n",
"\n",
" if cnt == 5:\n",
" if 0<=i-dx[k]<19 and 0<=j-dy[k]<19 and board[i-dx[k]][j-dy[k]] == v:\n",
" break\n",
" if 0<=xx+dx[k]<19 and 0<=yy+dy[k]<19 and board[xx+dx[k]][yy+dy[k]] == v:\n",
" break\n",
" \n",
" print(v)\n",
" print(i+1, j+1)\n",
" sys.exit(0)\n",
"\n",
" xx += dx[k]\n",
" yy += dy[k]\n",
"\n",
"print(0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 1b809bb

Please sign in to comment.