[TIL] 수학 알고리즘 문제 풀이, SocketIO, WebRTC 강의

백준 1011

https://www.acmicpc.net/problem/1011

const fs = require('fs')
const input = fs.readFileSync('dev/stdin').toString().trim().split('\n')

const [num, ...testCases] = input

for (let i = 0; i < +num; i++) {
	const [start, end] = testCases[i].split(' ').map((x) => +x)
	let distance = end - start
	let k = 1
	let count = 0
	while (distance > k * 2) {
		distance -= k * 2
        k++
        count += 2
	}
    if (distance <= k) {
        console.log(count + 1)
    } else {
        console.log(count + 2)
    }
}

이외에도 수학 알고리즘 문제 6개 더 풀이

https://github.com/fancyers/coding-test

줌 클론코딩 강의

SocketIO 파트 마무리
WebRTC 파트 시작
https://github.com/fancyers/zoom

좋은 웹페이지 즐겨찾기