λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
κ°œμΈκ³΅λΆ€/Algorithm

[λ°±μ€€][Node.js] 5575번 : νƒ€μž„ μΉ΄λ“œ

by πŸ‡λ°•λ΄‰λ΄‰πŸ‡ 2021. 11. 23.

 

 

Algorithm

-  νƒ€μž„ μΉ΄λ“œ -

 


 

문제

JOI μƒμ‚¬λŠ” μ§μ›μ˜ κ·Όλ¬΄μ‹œκ°„μ„ νƒ€μž„ μΉ΄λ“œλ‘œ κ΄€λ¦¬ν•˜κ³ μžˆλ‹€. 직원듀은 μ „μš© μž₯λΉ„λ₯Ό μ‚¬μš©ν•˜μ—¬ νƒ€μž„ μΉ΄λ“œμ— 좜근 μ‹œκ°„μ„ κΈ°λ‘ν•œλ‹€. 근무λ₯Ό 마치고 퇴근할 λ•Œλ„ νƒ€μž„ μΉ΄λ“œμ— 퇴근 μ‹œκ°„μ„ κΈ°λ‘ν•œλ‹€. νƒ€μž„μΉ΄λ“œμ—μ„œ μ‚¬μš©ν•˜λŠ” μ‹œκ°„λ‹¨μœ„λŠ” 24 μ‹œκ°„μ œλ₯Ό μ‚¬μš©ν•œλ‹€.

 

λ³΄μ•ˆμƒμ˜ 이유둜 μ§μ›λ“€μ˜ μΆœκ·Ό μ‹œκ°„μ€ 7μ‹œ 이후이닀. λ˜ν•œ, λͺ¨λ“  직원은 23μ‹œ 이전에 ν‡΄κ·Όν•œλ‹€. μ§μ›μ˜ 퇴근 μ‹œκ°„은 항상 좜근 μ‹œκ°„λ³΄λ‹€ λŠ¦λ‹€.

 

μž…λ ₯으둜 JOI μƒμ‚¬μ˜ 3 λͺ…μ˜ 직원 A 씨, B 씨, C μ”¨μ˜ 좜근 μ‹œκ°„κ³Ό 퇴근 μ‹œκ°„μ΄ μ£Όμ–΄ μ‘Œμ„ λ•Œ 각 μ§μ›μ˜ κ·Όλ¬΄μ‹œκ°„μ„ κ³„μ‚°ν•˜λŠ” ν”„λ‘œκ·Έλž¨μ„ μž‘μ„±ν•˜λΌ.

 

μž…μΆœλ ₯ μ˜ˆμ‹œ

 

문제 ν’€κΈ°

const readline = require("readline");
const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});
let input = [];
rl.on("line", function (line) {
	input.push(line.toString());
}).on("close", function () {
	input = input.map((el) => el.split(" ").map((el) => Number(el)));

	for (let i = 0; i < input.length; i++) {
		let [h, m, s] = [input[i][3], input[i][4], input[i][5]];
		if (s < input[i][2]) {
			s = 60 + s;
			m--;
			s = s - input[i][2];
		} else s = s - input[i][2];
		if (m < input[i][1]) {
			m = 60 + m;
			h--;
			m = m - input[i][1];
		} else m = m - input[i][1];
		h = h - input[i][0];
		console.log(h, m, s);
	}
	process.exit();
});

 

 

 

λ°˜μ‘ν˜•

λŒ“κΈ€