diff --git a/src/bj/silver/1/1931.js b/src/bj/silver/1/1931.js new file mode 100644 index 00000000..b2910fbf --- /dev/null +++ b/src/bj/silver/1/1931.js @@ -0,0 +1,26 @@ +'use strict'; + +const inputs = require('fs').readFileSync('/dev/stdin').toString().trim().split('\n'); +const n = inputs.shift(); +const timetable = []; +inputs.forEach((v) => { + let [start, end] = v.split(' '); + timetable.push([+start, +end]); +}); + +timetable.sort((a, b) => { + if(a[1] === b[1]) { + return a[0] - b[0]; + } + return a[1] - b[1]; +}); + +const answer = []; +let element = 0; // end값을 저장할 변수 +for(let x of timetable) { + if(x[0] >= element) { + answer.push(x); + element = x[1]; + } +} +console.log(answer.length); \ No newline at end of file diff --git a/src/bj/silver/1/README.md b/src/bj/silver/1/README.md new file mode 100644 index 00000000..0d5d04ed --- /dev/null +++ b/src/bj/silver/1/README.md @@ -0,0 +1,4 @@ +# Silver 1 +||문제번호|문제명|응시 날짜|채점 결과|링크| +|:-:|:--:|:--:|:---:|:---:|--| +|1|1913|[회의실 배정](./1931.js)|22.08.12|한번 더 풀기||