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, []);