From fe95a079e423d0c562ffc43617ccaef437ee49f9 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Sat, 12 Jul 2025 17:39:54 +0900 Subject: [PATCH] 20250712 baekjoon --- code_study/Baekjoon/c/11047.c | 23 +++++++++++++++++++++++ code_study/Baekjoon/ts/11399.ts | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 code_study/Baekjoon/c/11047.c create mode 100644 code_study/Baekjoon/ts/11399.ts 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);