diff --git a/code_study/Baekjoon/c/11047.c b/code_study/Baekjoon/c/11047.c new file mode 100644 index 0000000..97b745e --- /dev/null +++ b/code_study/Baekjoon/c/11047.c @@ -0,0 +1,23 @@ +#include +#include + +int main() { + int N, K; + scanf("%d %d",&N, &K); + int* coin = (int*)malloc(sizeof(int)*N); + for(int i=0; i=0; i--){ + if(coin[i]<=k_diff){ + count += k_diff/coin[i]; + k_diff = k_diff%coin[i]; + } + } + printf("%d\n",count); + + free(coin); + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/ts/11399.ts b/code_study/Baekjoon/ts/11399.ts new file mode 100644 index 0000000..096a217 --- /dev/null +++ b/code_study/Baekjoon/ts/11399.ts @@ -0,0 +1,9 @@ +export {} +const input: string[] = require("fs").readFileSync(0, "utf8").toString().trim().split('\n'); +const arr: number[] = input[1].split(" ").map(Number).sort((a,b) => a-b); +let [sum, acc] = [0,0]; +for(let v of arr){ + acc += v; + sum += acc; +} +console.log(sum);