728x90
let input = require('fs').readFileSync('/dev/stdin').toString().split(" ");
input = input.map(Number);
const hour = input[0] == 0 ? 24 : input[0];
const minutes = input[1];
const backTo45Minutes = hour * 60 + minutes - 45;
const earlyHour = Math.floor(backTo45Minutes / 60);
const earlyMinites = backTo45Minutes - earlyHour * 60;
console.log(earlyHour == 24 ? 0 : earlyHour, earlyMinites);
๐ฑ ์๊ฐ์ด 0์ ์ผ ๊ฒฝ์ฐ๋ฅผ ์ ๊ณ ๋ คํด์ 24์๋ก ๊ณ์ฐํ๊ณ ,
๊ณ์ฐ ๊ฒฐ๊ณผ 24์๊ฐ ๋์ฌ ๊ฒฝ์ฐ ์ถ๋ ฅ์ 0์ผ๋ก ์ถ๋ ฅ๋๊ฒ ์จ์ค์ผ ํ๋ฆฌ์ง ์๋๋ค.
728x90
๋ฐ์ํ
'ํ์ ๊ณต๋ถ > ๐ซง ์๊ณ ๋ฆฌ์ฆ ๊ณต๋ถ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค/Node.js] 2480๋ฒ ํ์ด || JavaScript (0) | 2023.02.22 |
---|---|
[๋ฐฑ์ค/Node.js] 2525๋ฒ ํ์ด || JavaScript (0) | 2023.02.22 |
[๋ฐฑ์ค/Node.js] 11382๋ฒ ํ์ด || JavaScript (0) | 2023.02.21 |
[๋ฐฑ์ค/Node.js] 14681๋ฒ ํ์ด || JavaScript (0) | 2023.02.21 |
[๋ฐฑ์ค/Node.js] 2753๋ฒ ํ์ด || JavaScript (0) | 2023.02.21 |