From 84184b3ea4da550a1fe9cd955709de8f85f10a32 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Fri, 22 Aug 2025 21:38:12 +0900 Subject: [PATCH] 20250822 baekjoon --- code_study/Baekjoon/c/15652.c | 31 ++++++++++++++++ code_study/Baekjoon/c/15654.c | 51 +++++++++++++++++++++++++++ code_study/Baekjoon/swift/15652.swift | 24 +++++++++++++ code_study/Baekjoon/swift/15654.swift | 30 ++++++++++++++++ code_study/Baekjoon/ts/15652.ts | 17 +++++++++ code_study/Baekjoon/ts/15654.ts | 25 +++++++++++++ 6 files changed, 178 insertions(+) create mode 100644 code_study/Baekjoon/c/15652.c create mode 100644 code_study/Baekjoon/c/15654.c create mode 100644 code_study/Baekjoon/swift/15652.swift create mode 100644 code_study/Baekjoon/swift/15654.swift create mode 100644 code_study/Baekjoon/ts/15652.ts create mode 100644 code_study/Baekjoon/ts/15654.ts diff --git a/code_study/Baekjoon/c/15652.c b/code_study/Baekjoon/c/15652.c new file mode 100644 index 0000000..9598121 --- /dev/null +++ b/code_study/Baekjoon/c/15652.c @@ -0,0 +1,31 @@ +#include +#include + +void dfs(int n, int m, int now, int len, int* result); + +int main(){ + int N, M; + scanf("%d %d",&N, &M); + + int* result = (int*)malloc(sizeof(int)*(M+1)); + dfs(N, M, 1, 0, result); + free(result); + + return 0; +} + +void dfs(int n, int m, int now, int len, int* result){ + if(len==m){ + for(int i=0; i +#include +#include +#include + +void dfs(const int n, const int m, int len, int* result, bool* visited, const int* nums); +int compare(const void *a, const void *b); + +int main(){ + int N, M; + scanf("%d %d",&N, &M); + + int* result = (int*)malloc(sizeof(int)*M); + int* nums = (int*)malloc(sizeof(int)*N); + bool* visited = (bool*)malloc(sizeof(bool)*N); + for(int i=0; i false); +nums.sort((a,b)=>a-b); +dfs(N, M, nums, visited, []);