-
항해 99 5기 TIL_41항해 99 2022. 2. 20. 22:07
▶ Today I Learned
[동전]
소요시간: 30분
해결 여부: 해결
https://www.acmicpc.net/problem/11047
const fs = require("fs") let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n'); let info = input[0].split(' ') let n = info[0]/1 let k = info[1]/1 let a = [] let count = 0 for (let i = 1; i < input.length; i++) { a.push(input[i] / 1) }; let j = a.length - 1 while (k > 0) { if (1<= k/a[j]) { count = count + Math.floor(k/a[j]) k = k % a[j] j-- } else { j-- } } console.log(count)
사실 풀이는 이전에 replit에서 푼 것과 똑같은 로직이다.
바꾼 거라곤 주석을 몇개 지운 것과 k를 k = k - a[j]*count 하지 않고 k = k % a[j] 한 것 뿐이다.
왜 기존의 것이 통과하지 못한 것인지는 여전히 미스테리이나 이렇게 통과하게 되어 기쁘다!
몇몇 풀이들을 살펴보니 제출 시에는 주석을 지우라는 말이 있었다.
하지만 주석만 지웠을 때는 제출되지 않았다.
k = k % a[j]나 주석 둘 다 영향을 끼쳤거나 둘 중 하나만 영향을 끼쳤을 수도 있겠다는 생각이 들었다.
[클론 코딩 - 텀블벅]
우리 팀은 텀블벅의 일부분을 클론코딩 해보기로 했다.
화면의 구성은 복잡했지만 백엔드 쪽에서 구현하기로 한 부분은 지난 주 했던 것과 크게 다르지 않다.
우선은 Mongo DB로 빠르게 구현 후 그동안 시도해보지 못한 mysql과 TDD를 해보고 싶다.
▶ 느낀 점
알고리즘 문제도 풀이 과정에서 막히고 클론코딩도 서버배포까지는 문제없지만 서버DB연결이 이루어지지 않았다.
구글링해보며 이것저것 답을 찾았지만 아직 해결하지는 못했다.
답답하기도 했지만 내일 또 도전해보자..! 할 수 있다..!
▶ 공부 시 참고 링크들
https://blog.jaeyoon.io/2018/01/git-crlf.html
https://mylko72.gitbooks.io/git/content/commit/remove.html
'항해 99' 카테고리의 다른 글
항해 99 5기 WIL_6 (0) 2022.02.20 항해 99 5기 TIL_42 (0) 2022.02.20 항해 99 5기 TIL_40 (0) 2022.02.19 항해 99 5기 TIL_39 (0) 2022.02.18 항해 99 5기 TIL_38 (0) 2022.02.17