Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions Algorithm/Code/20185164_Week2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "bf192f11-9b6f-422a-aca2-40f1b14b9ba8",
"metadata": {},
"source": [
"## 문제 1 시험감독\n",
"* 시험장의 개수 N, i시험장 응시자의 수 Ai, 총감독관, 부감독관 : B,C"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "d79c61f7-6102-4181-939d-2ab639216364",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 1\n",
" 1\n",
" 1 1\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
]
}
],
"source": [
"room = int(input())\n",
"\n",
"num = list(map(int, input().split()))\n",
"\n",
"viewer, sub_viewer = map(int, input().split())\n",
"\n",
"v_num = 0\n",
"\n",
"n = [num[i]-viewer for i in range(len(num))]\n",
"v_num += len(num)\n",
"\n",
"\n",
"for i in n:\n",
" if i <= 0:\n",
" continue\n",
" else:\n",
" if i%sub_viewer:\n",
" v_num+=(i//sub_viewer+1)\n",
" else:\n",
" v_num+=(i//sub_viewer)\n",
"print(v_num)"
]
},
{
"cell_type": "markdown",
"id": "1ef9059e-7d64-4f16-9e81-af12aba6fff7",
"metadata": {},
"source": [
"## 문제 2 좌표\n",
"* 2차원 평면에 점 N개, 좌표를 x좌표가 증가하는 순으로, x좌표가 같으면 y좌표가 증가하는 순으로 정렬 후 출력"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "c676592a-ba04-4ce7-a5f5-0c5c48e59297",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 5\n",
" 3 4\n",
" 1 1\n",
" 1 -1\n",
" 2 2\n",
" 3 3\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 -1\n",
"1 1\n",
"2 2\n",
"3 3\n",
"3 4\n"
]
}
],
"source": [
"N = int(input())\n",
"coord=[]\n",
"for i in range(N):\n",
" x,y = map(int,input().split())\n",
" coord.append((x,y))\n",
"coord.sort()\n",
"for i in range(N):\n",
" print(coord[i][0], coord[i][1])\n",
" \n"
]
},
{
"cell_type": "markdown",
"id": "f6a6379f-bf34-4698-a78b-6edc35b8432b",
"metadata": {},
"source": [
"## 문제 3 골드바흐의 추측\n",
"* 4보다 큰 모든 짝수는 두 홀수 소수의 합으로 나타낼 수 있다"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "87c9acc0-44d6-4dbe-8ab1-6ad8d48e95e5",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 8\n",
" 20\n",
" 42\n",
" 0\n"
]
},
{
"data": {
"text/plain": [
"[8, 20, 42]"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lst=[]\n",
"while(True):\n",
" if a==0:\n",
" break\n",
" else:\n",
" lst.append(a)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "efa7f812-ba30-4456-82f7-2b02cd3c3124",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
185 changes: 185 additions & 0 deletions Algorithm/Code/Week3/20185164_Week2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "bf192f11-9b6f-422a-aca2-40f1b14b9ba8",
"metadata": {},
"source": [
"## 문제 1 시험감독\n",
"* 시험장의 개수 N, i시험장 응시자의 수 Ai, 총감독관, 부감독관 : B,C"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "d79c61f7-6102-4181-939d-2ab639216364",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 1\n",
" 1\n",
" 1 1\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
]
}
],
"source": [
"room = int(input())\n",
"\n",
"num = list(map(int, input().split()))\n",
"\n",
"viewer, sub_viewer = map(int, input().split())\n",
"\n",
"v_num = 0\n",
"\n",
"n = [num[i]-viewer for i in range(len(num))]\n",
"v_num += len(num)\n",
"\n",
"\n",
"for i in n:\n",
" if i <= 0:\n",
" continue\n",
" else:\n",
" if i%sub_viewer:\n",
" v_num+=(i//sub_viewer+1)\n",
" else:\n",
" v_num+=(i//sub_viewer)\n",
"print(v_num)"
]
},
{
"cell_type": "markdown",
"id": "1ef9059e-7d64-4f16-9e81-af12aba6fff7",
"metadata": {},
"source": [
"## 문제 2 좌표\n",
"* 2차원 평면에 점 N개, 좌표를 x좌표가 증가하는 순으로, x좌표가 같으면 y좌표가 증가하는 순으로 정렬 후 출력"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "c676592a-ba04-4ce7-a5f5-0c5c48e59297",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 5\n",
" 3 4\n",
" 1 1\n",
" 1 -1\n",
" 2 2\n",
" 3 3\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 -1\n",
"1 1\n",
"2 2\n",
"3 3\n",
"3 4\n"
]
}
],
"source": [
"N = int(input())\n",
"coord=[]\n",
"for i in range(N):\n",
" x,y = map(int,input().split())\n",
" coord.append((x,y))\n",
"coord.sort()\n",
"for i in range(N):\n",
" print(coord[i][0], coord[i][1])\n",
" \n"
]
},
{
"cell_type": "markdown",
"id": "f6a6379f-bf34-4698-a78b-6edc35b8432b",
"metadata": {},
"source": [
"## 문제 3 골드바흐의 추측\n",
"* 4보다 큰 모든 짝수는 두 홀수 소수의 합으로 나타낼 수 있다"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "87c9acc0-44d6-4dbe-8ab1-6ad8d48e95e5",
"metadata": {},
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
" 8\n",
" 20\n",
" 42\n",
" 0\n"
]
},
{
"data": {
"text/plain": [
"[8, 20, 42]"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lst=[]\n",
"while(True):\n",
" if a==0:\n",
" break\n",
" else:\n",
" lst.append(a)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "efa7f812-ba30-4456-82f7-2b02cd3c3124",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading