-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
const inputs = require('fs').readFileSync('/dev/stdin').toString().trim().split('\n'); | ||
const n = inputs.shift(); | ||
let timeTable = []; | ||
inputs.forEach((line) => { | ||
let [start, end] = line.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 endTime = 0; | ||
for(let [start, end] of timeTable) { | ||
if(start >= endTime) { // 현재 시간이, 그 전 endTime보다 크거나 같다면 | ||
answer.push([start, end]); | ||
endTime = end; | ||
} | ||
} | ||
|
||
console.log(answer.length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Silver 1 | ||
||문제번호|문제명|응시 날짜|채점 결과|링크| | ||
|:-:|:--:|:--:|:---:|:---:|--| | ||
|1|1913|[회의실 배정](./1931.js)|22.08.12|한번 더 풀기|| | ||
|1|1913|[회의실 배정](./1931.js)|22.08.12|[22.08.13](./1931_re.js)|| |