From 841d32138f8286a50e1906c536936705eeb0b07a Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Wed, 23 Jul 2025 22:28:02 +0900 Subject: [PATCH] 20250723 baekjoon --- code_study/Baekjoon/c/1654.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 code_study/Baekjoon/c/1654.c diff --git a/code_study/Baekjoon/c/1654.c b/code_study/Baekjoon/c/1654.c new file mode 100644 index 0000000..626174f --- /dev/null +++ b/code_study/Baekjoon/c/1654.c @@ -0,0 +1,36 @@ +#include +#include + +int main(){ + int K, N; + scanf("%d %d",&K, &N); + int* cable = (int*)malloc(sizeof(int)*K); + scanf("%d",&cable[0]); + long long start = 1; + long long end = cable[0]; + for(int i=1; iend) end = cable[i]; + } + + long long result; + while(start<=end){ + int count = 0; + long long mid = (long long)(start + end)/2; + for(int i=0; i= N) { + result = mid; + start = mid + 1; + } + } + + printf("%lld\n",result); + free(cable); + return 0; +} \ No newline at end of file