From f9eeb5044a659c2959f199e459785e2dd9b82e33 Mon Sep 17 00:00:00 2001 From: Hoyoung Jung Date: Mon, 3 Jun 2019 15:48:06 +0900 Subject: [PATCH 1/3] BOJ 1913 snail --- 190530/honux/1913-snail.cpp | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 190530/honux/1913-snail.cpp diff --git a/190530/honux/1913-snail.cpp b/190530/honux/1913-snail.cpp new file mode 100644 index 0000000..9983edf --- /dev/null +++ b/190530/honux/1913-snail.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include + +using namespace std; +int dr[] = { -1, 0, 1, 0 }; +int dc[] = { 0, 1, 0, -1 }; + + +int main() { + int n; + scanf("%d", &n); + vector > m(n); + map> nmap; + for (int i = 0; i < n; i++) { + m[i].resize(n); + } + + int num = 1; + int row = n / 2; + int col = row; + double w = 1; + m[row][col] = num; + int vec = 0; + + bool loop = true; + while (loop) { + for (int i = 0; i < (int) w; i++) { + num++; + if (num > n * n) { + loop = false; + break; + } + row += dr[vec]; + col += dc[vec]; + m[row][col] = num; + nmap[num] = make_pair(row + 1, col + 1); + } + vec = (vec + 1) % 4; + w += 0.5; + } + + for (auto v : m) { + for (auto n : v) { + printf("%d ", n); + } + printf("\n"); + } + + int x; + scanf("%d", &x); + printf("%d %d\n", nmap[x].first, nmap[x].second); + return 0; +} From b16ced85ef6b85f7c9097339c42000577dd71430 Mon Sep 17 00:00:00 2001 From: Hoyoung Jung Date: Tue, 11 Jun 2019 17:29:05 +0900 Subject: [PATCH 2/3] Update 190611 problem --- 190611/problem.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 190611/problem.md diff --git a/190611/problem.md b/190611/problem.md new file mode 100644 index 0000000..07c8f5c --- /dev/null +++ b/190611/problem.md @@ -0,0 +1,6 @@ +# 소수 찾기 + +- https://programmers.co.kr/learn/courses/30/lessons/42839 +- 분류: 완전탐색 +- 난이도: 2 + From 941767a20bb0814bac0a445f864087f8ca0e2411 Mon Sep 17 00:00:00 2001 From: Hoyoung Jung Date: Thu, 13 Jun 2019 14:21:31 +0900 Subject: [PATCH 3/3] Update problem 109613 BOJ O(n) sort --- 190613/problem.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 190613/problem.md diff --git a/190613/problem.md b/190613/problem.md new file mode 100644 index 0000000..cb8892d --- /dev/null +++ b/190613/problem.md @@ -0,0 +1,5 @@ +# BOJ 정렬하기 3 + +- https://www.acmicpc.net/problem/10989 +- 난이도: 2점 +