From 69c5c77abcb0bc084aa4f7b100266e1b8f000f85 Mon Sep 17 00:00:00 2001 From: Min-92 <0201.mj.lee@gmail.com> Date: Fri, 24 May 2019 11:28:55 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[Wangmin]=20190523=20=EC=95=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=EC=A6=98=20=EA=B0=80=EC=9E=A5=20=ED=81=B0=20=EC=88=98?= =?UTF-8?q?=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 190523/wangmin/pg42746.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 190523/wangmin/pg42746.cpp diff --git a/190523/wangmin/pg42746.cpp b/190523/wangmin/pg42746.cpp new file mode 100644 index 0000000..2fbd7a5 --- /dev/null +++ b/190523/wangmin/pg42746.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +using namespace std; + +bool func(string a, string b){ + return a+b > b+a ? true : false; +} + +string solution(vector numbers) { + string answer = ""; + vector str; + for(int i = 0 ; i < numbers.size(); i++){ + str.push_back(to_string(numbers[i])); + } + + sort(str.begin(), str.end(), func); + for(int i = 0; i < str.size(); i++){ + answer += str[i]; + } + if(answer[0] == '0'){ + return "0"; + } + + return answer; +} \ No newline at end of file From 1f767595707c0effd495d5aab02c4bc51c0adca3 Mon Sep 17 00:00:00 2001 From: Min-92 <0201.mj.lee@gmail.com> Date: Fri, 24 May 2019 14:11:45 +0900 Subject: [PATCH 2/4] [wangmin] programmers 42747 H-index -sort --- 190524/wangmin/pg42747.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 190524/wangmin/pg42747.cpp diff --git a/190524/wangmin/pg42747.cpp b/190524/wangmin/pg42747.cpp new file mode 100644 index 0000000..8d1425a --- /dev/null +++ b/190524/wangmin/pg42747.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +using namespace std; + +int solution(vector citations) { + int h; + sort(citations.begin(),citations.end()); + for(int i = 0; i< citations.size(); i++){ + h = citations.size()-i; + + if(citations[i] >= h){ + return h; + } + + } + return 0; +} + From 2d11b0d95c202f973b9405bd5d26a249a26d076e Mon Sep 17 00:00:00 2001 From: wangmin <0201.mj.lee@gmail.com> Date: Mon, 27 May 2019 14:02:35 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[wangmin]=20programmers=2042840=20=EB=AA=A8?= =?UTF-8?q?=EC=9D=98=EA=B3=A0=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 190527/wangmin/pg42840.cpp | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 190527/wangmin/pg42840.cpp diff --git a/190527/wangmin/pg42840.cpp b/190527/wangmin/pg42840.cpp new file mode 100644 index 0000000..941df3c --- /dev/null +++ b/190527/wangmin/pg42840.cpp @@ -0,0 +1,49 @@ +#include +#include +#include + +using namespace std; + +vector solution(vector answers) { + vector one = {1,2,3,4,5}; + vector two = {2,1,2,3,2,4,2,5}; + vector three = {3,3,1,1,2,2,4,4,5,5}; + + int oneCount = 0; + int twoCount = 0; + int threeCount = 0; + + for(int i = 0; i < answers.size(); i++){ + if(answers[i] == one[i%one.size()]){ + oneCount++; + } + } + + int max = oneCount; + + for(int i = 0; i < answers.size(); i++){ + if(answers[i] == two[i%two.size()]){ + twoCount++; + } + } + + max = (twoCount > max) ? twoCount : max; + + for(int i = 0; i < answers.size(); i++){ + if(answers[i] == three[i%three.size()]){ + threeCount++; + } + } + + max = (threeCount > max) ? threeCount : max; + + + + vector answer; + if(max == oneCount) answer.push_back(1); + if(max == twoCount) answer.push_back(2); + if(max == threeCount) answer.push_back(3); + + + return answer; +} \ No newline at end of file From b2536543fa32a3a9f44a474e1205b84a5f45f4f3 Mon Sep 17 00:00:00 2001 From: wangmin <0201.mj.lee@gmail.com> Date: Fri, 31 May 2019 11:59:20 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[wangmin]=20baek=20joon=201913=20=EB=8B=AC?= =?UTF-8?q?=ED=8C=BD=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 190530/wangmin/bj1913.cpp | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 190530/wangmin/bj1913.cpp diff --git a/190530/wangmin/bj1913.cpp b/190530/wangmin/bj1913.cpp new file mode 100644 index 0000000..af70292 --- /dev/null +++ b/190530/wangmin/bj1913.cpp @@ -0,0 +1,53 @@ +//https://www.acmicpc.net/problem/1913 + +#include +#include + +using namespace std; + +int main () { + int n,a; + cin >> n >> a; + + vector> vec = vector>(n,(vector(n,0))); + + vector start ={n/2,n/2}; + vector> right = {{-1,0},{0,1},{1,0},{0,-1}}; + vector head = {-1,0}; + + vector aindex = {0,0}; + + // vec[start[0]][start[1]] = 1; + int rightindex = 0; + for(int i = 1; i <= n*n; i ++){ + // vec[start[0],start[1]] + vec[start[0]][start[1]] = i; + + if(i == a){ + aindex = {start[0],start[1]}; + } + + if(vec[start[0]+right[rightindex%4][0]][start[1]+right[rightindex%4][1]] == 0){ + head = right[rightindex%4]; + start[0] = start[0]+head[0]; + start[1] = start[1]+head[1]; + rightindex++; + }else{ + start[0] = start[0]+head[0]; + start[1] = start[1]+head[1]; + } + } + + for(int i = 0; i < n; i++){ + for(int j = 0; j < n; j++){ + cout << vec[i][j]<<" "; + } + cout << "\n"; + } + + cout << aindex[0]+1 << " " << aindex[1]+1<