From 060f3d835ca293d4ee58eed61a4754c3c6f003d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Tue, 6 Aug 2024 23:25:13 +0900 Subject: [PATCH 1/9] Update 1620.js --- "oesnuj/\355\225\264\354\213\234/1620.js" | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" index d78b8f5..3511f15 100644 --- "a/oesnuj/\355\225\264\354\213\234/1620.js" +++ "b/oesnuj/\355\225\264\354\213\234/1620.js" @@ -15,13 +15,12 @@ pokemonList.forEach((pokemon, index) => { let result = ''; testList.forEach(test => { - const num = Number(test); - if (!isNaN(num)) { + if (!isNaN(test)) { // 테스트 값이 번호인 경우 - result += pokemonList[num - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 + result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 } else { // 테스트 값이 이름인 경우 result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 } }); -console.log(result); \ No newline at end of file +console.log(result); From 00e8e235c91cee7a6c3f7ecbdc919259d2a58f91 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 16:55:40 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=EC=B6=A9=EB=8F=8C=20=EA=B3=A0=EC=B9=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oesnuj/DP/2775.cpp | 53 ---------------------- "oesnuj/\354\236\254\352\267\200/1914.cpp" | 33 -------------- 2 files changed, 86 deletions(-) delete mode 100644 oesnuj/DP/2775.cpp delete mode 100644 "oesnuj/\354\236\254\352\267\200/1914.cpp" diff --git a/oesnuj/DP/2775.cpp b/oesnuj/DP/2775.cpp deleted file mode 100644 index c7cf2e6..0000000 --- a/oesnuj/DP/2775.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/*풀이1 재귀만 이용*/ -//#include -//using namespace std; -// -//int calc(int k, int n) { -// if (k == 0) return n; -// int sum = 0; -// for (int i = n; i > 0; i--) { -// sum += calc(k - 1, i); -// } -// return sum; -//} -// -//int main() -//{ -// int T, k, n; -// cin >> T; -// while (T--) { -// cin >> k >> n; -// cout << calc(k, n) << "\n"; -// } -// return 0; -//} - -/*풀이2, 재귀 + DP*/ -#include -#include -using namespace std; - -vector> dp; - -int calc(int k, int n) { - if (k == 0) return n; - if (dp[k][n] != -1) return dp[k][n]; // 이미 계산된 값이면 반환 - - int sum = 0; - for (int i = n; i > 0; i--) { - sum += calc(k - 1, i); - } - return dp[k][n] = sum; // 계산된 값을 저장하고 반환 -} - -int main() -{ - int T, k, n; - cin >> T; - while (T--) { - cin >> k >> n; - dp = vector>(k + 1, vector(n + 1, -1)); //케이스별 DP 테이블 초기화 - cout << calc(k, n) << "\n"; - } - return 0; -} diff --git "a/oesnuj/\354\236\254\352\267\200/1914.cpp" "b/oesnuj/\354\236\254\352\267\200/1914.cpp" deleted file mode 100644 index 90b8165..0000000 --- "a/oesnuj/\354\236\254\352\267\200/1914.cpp" +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -using namespace std; - -void RecurMoveDisks(int n, int from, int temp, int to) { - if (n == 0) return; - //n-1개의 원판으로 temp로 옮긴다. - RecurMoveDisks(n - 1, from, to, temp); - - //남은 1개의 원판으로 to로 옮긴다. <- 이때 옮기는 과정 출력 - cout << from << " " << to << "\n"; - - //temp에 있던 n-1개의 원판을 n-1개로 옮긴다. - RecurMoveDisks(n - 1, temp, from, to); -} - -int main() { - ios::sync_with_stdio(false); cin.tie(nullptr); - int n; - cin >> n; - - //2의 n제곱 -1 출력하기 - string cnt = to_string(pow(2, n)); - int x = cnt.find('.'); - cnt = cnt.substr(0, x); - cnt[cnt.length() - 1] -= 1; - cout << cnt << "\n"; - - //조건에 맞는 경우에만 재귀를 돌린다. - if (n <= 20) RecurMoveDisks(n, 1, 2, 3); - return 0; -} \ No newline at end of file From 699ca479011b60661e22104adc7cfd8919c1e223 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 16:56:30 +0900 Subject: [PATCH 3/9] Delete 1620.js --- "oesnuj/\355\225\264\354\213\234/1620.js" | 26 ----------------------- 1 file changed, 26 deletions(-) delete mode 100644 "oesnuj/\355\225\264\354\213\234/1620.js" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" deleted file mode 100644 index 3511f15..0000000 --- "a/oesnuj/\355\225\264\354\213\234/1620.js" +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs'); -const filepath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; -const input = fs.readFileSync(filepath).toString().trim().split('\n'); - -const N = +input[0].split(' ')[0]; -const pokemonList = input.slice(1, 1 + N); -const testList = input.slice(1 + N); - -// 이름을 키로 하고 번호를 값으로 하는 단일 Map 객체 생성 -const pokemonMap = new Map(); -pokemonList.forEach((pokemon, index) => { - const number = index + 1; - pokemonMap.set(pokemon, number); -}); - -let result = ''; -testList.forEach(test => { - if (!isNaN(test)) { - // 테스트 값이 번호인 경우 - result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 - } else { - // 테스트 값이 이름인 경우 - result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 - } -}); -console.log(result); From 9b6ed77e4b4d4733cc6faff5bc500b367c869eb2 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 16:57:51 +0900 Subject: [PATCH 4/9] Create 1620.js --- "oesnuj/\355\225\264\354\213\234/1620.js" | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "oesnuj/\355\225\264\354\213\234/1620.js" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" new file mode 100644 index 0000000..fdb616c --- /dev/null +++ "b/oesnuj/\355\225\264\354\213\234/1620.js" @@ -0,0 +1,26 @@ +const fs = require('fs'); +const filepath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; +const input = fs.readFileSync(filepath).toString().trim().split('\n'); + +const N = +input[0].split(' ')[0]; +const pokemonList = input.slice(1, 1 + N); +const testList = input.slice(1 + N); + +// 이름을 키로 하고 번호를 값으로 하는 단일 Map 객체 생성 +const pokemonMap = new Map(); +pokemonList.forEach((pokemon, index) => { + const number = index + 1; + pokemonMap.set(pokemon, number); +}); + +let result = ''; +testList.forEach(test => { + if (!isNaN(test)) { + // 테스트 값이 번호인 경우 + result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 + } else { + // 테스트 값이 이름인 경우 + result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 + } +}); +console.log(result); \ No newline at end of file From 4fe92702ab8611d2533ff17d221bdd058fa50f25 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 17:02:12 +0900 Subject: [PATCH 5/9] Delete 1620.js --- "oesnuj/\355\225\264\354\213\234/1620.js" | 26 ----------------------- 1 file changed, 26 deletions(-) delete mode 100644 "oesnuj/\355\225\264\354\213\234/1620.js" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" deleted file mode 100644 index fdb616c..0000000 --- "a/oesnuj/\355\225\264\354\213\234/1620.js" +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs'); -const filepath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; -const input = fs.readFileSync(filepath).toString().trim().split('\n'); - -const N = +input[0].split(' ')[0]; -const pokemonList = input.slice(1, 1 + N); -const testList = input.slice(1 + N); - -// 이름을 키로 하고 번호를 값으로 하는 단일 Map 객체 생성 -const pokemonMap = new Map(); -pokemonList.forEach((pokemon, index) => { - const number = index + 1; - pokemonMap.set(pokemon, number); -}); - -let result = ''; -testList.forEach(test => { - if (!isNaN(test)) { - // 테스트 값이 번호인 경우 - result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 - } else { - // 테스트 값이 이름인 경우 - result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 - } -}); -console.log(result); \ No newline at end of file From ed33cb1031da78ae8ed77da71ead8626a5e98874 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 17:05:50 +0900 Subject: [PATCH 6/9] Create 1620.txt --- "oesnuj/\355\225\264\354\213\234/1620.txt" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "oesnuj/\355\225\264\354\213\234/1620.txt" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.txt" "b/oesnuj/\355\225\264\354\213\234/1620.txt" new file mode 100644 index 0000000..0519ecb --- /dev/null +++ "b/oesnuj/\355\225\264\354\213\234/1620.txt" @@ -0,0 +1 @@ + \ No newline at end of file From fbf3a048b1b776060f7eb235142bec21912afc27 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 17:09:03 +0900 Subject: [PATCH 7/9] Delete 1620.txt --- "oesnuj/\355\225\264\354\213\234/1620.txt" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "oesnuj/\355\225\264\354\213\234/1620.txt" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.txt" "b/oesnuj/\355\225\264\354\213\234/1620.txt" deleted file mode 100644 index 0519ecb..0000000 --- "a/oesnuj/\355\225\264\354\213\234/1620.txt" +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 01f9af9469d4ed9d9ef193b5d9276bdebc0cbf17 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 17:10:15 +0900 Subject: [PATCH 8/9] =?UTF-8?q?=EC=B6=A9=EB=8F=8C=20=EA=B3=A0=EC=B9=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "oesnuj/\355\225\264\354\213\234/1620.js" | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "oesnuj/\355\225\264\354\213\234/1620.js" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" new file mode 100644 index 0000000..fdb616c --- /dev/null +++ "b/oesnuj/\355\225\264\354\213\234/1620.js" @@ -0,0 +1,26 @@ +const fs = require('fs'); +const filepath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; +const input = fs.readFileSync(filepath).toString().trim().split('\n'); + +const N = +input[0].split(' ')[0]; +const pokemonList = input.slice(1, 1 + N); +const testList = input.slice(1 + N); + +// 이름을 키로 하고 번호를 값으로 하는 단일 Map 객체 생성 +const pokemonMap = new Map(); +pokemonList.forEach((pokemon, index) => { + const number = index + 1; + pokemonMap.set(pokemon, number); +}); + +let result = ''; +testList.forEach(test => { + if (!isNaN(test)) { + // 테스트 값이 번호인 경우 + result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 + } else { + // 테스트 값이 이름인 경우 + result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 + } +}); +console.log(result); \ No newline at end of file From 3fd2e87373275313149ce9de900191cd8b2b1f82 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Thu, 5 Sep 2024 17:12:43 +0900 Subject: [PATCH 9/9] Delete 1620.js --- "oesnuj/\355\225\264\354\213\234/1620.js" | 26 ----------------------- 1 file changed, 26 deletions(-) delete mode 100644 "oesnuj/\355\225\264\354\213\234/1620.js" diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" deleted file mode 100644 index fdb616c..0000000 --- "a/oesnuj/\355\225\264\354\213\234/1620.js" +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs'); -const filepath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; -const input = fs.readFileSync(filepath).toString().trim().split('\n'); - -const N = +input[0].split(' ')[0]; -const pokemonList = input.slice(1, 1 + N); -const testList = input.slice(1 + N); - -// 이름을 키로 하고 번호를 값으로 하는 단일 Map 객체 생성 -const pokemonMap = new Map(); -pokemonList.forEach((pokemon, index) => { - const number = index + 1; - pokemonMap.set(pokemon, number); -}); - -let result = ''; -testList.forEach(test => { - if (!isNaN(test)) { - // 테스트 값이 번호인 경우 - result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 - } else { - // 테스트 값이 이름인 경우 - result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 - } -}); -console.log(result); \ No newline at end of file