๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

ํ”„์—” ๊ณต๋ถ€/๐Ÿซง ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ณต๋ถ€

[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ๋ฐฑ์ค€] 10250 ACM ํ˜ธํ…” JS

728x90
let input = require('fs').readFileSync('./dev/stdin').toString().trim().split("\n").map(v => v.replace("\r", ""));

const N = +input[0];

for (let i = 1; i <= N; i++) {
    let [H, W, N] = input[i].split(" ")
    const floor = N % H === 0 ? H : N % H;
    const ho = Math.ceil(N / H)
    console.log(ho < 10 ? `${floor}0${ho}` : `${floor}${ho}`)
}

 

์ฒ˜์Œ์— ํ‹€๋ ธ์Šต๋‹ˆ๋‹ค๊ฐ€ ๋‚˜์™€์„œ ๋ญ๊ฐ€ ํ‹€๋ ธ๋‚˜ ํ•˜๊ณ 

์˜ˆ์ œ ๊ฐ’์„ 6 12 72 ๋กœ ๋ณ€๊ฒฝํ•ด์„œ ์ค˜๋ดค๋”๋‹ˆ

612๊ฐ€ ๋‚˜์™€์•ผ ํ•˜๋Š”๋ฐ 012 ๊ฐ€ ๋‚˜์™”๋‹ค. ์˜ค์šฐ...!

๊ทธ๋ž˜์„œ ๋‚˜๋จธ์ง€ ๊ฐ’์ด 0์ด๋ผ๋ฉด H๋ฅผ, ์•„๋‹ˆ๋ผ๋ฉด N%H ๋ฅผ floor์— ํ• ๋‹นํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ˆ˜์ •ํ–ˆ๋”๋‹ˆ ํ†ต๊ณผํ–ˆ๋‹ค. 

์‚ฌ์‹ค์ƒ W๋Š” ํ•„์š”๊ฐ€ ์—†์—ˆ์Œ~

 

 

728x90
๋ฐ˜์‘ํ˜•