콘텐츠로 건너뛰기
» [백준10250] ACM호텔

[백준10250] ACM호텔

문제 : https://www.acmicpc.net/problem/10250

<내 풀이 with node.js>

const fs = require("fs");
const input = fs.readFileSync(0).toString().trim().split('\n');
const t = Number(input[0]);
const data = input.slice(1);

for(let i=0; i<t; i++) {
    let [H, W, N] = data[i].split(' ').map(Number);
    let cnt = 0;
    let rH = 0, rW = 0;
    
    for(let w=1; w<=W; w++) {
        rW = w;
        for(let h=1; h<=H; h++) {
            rH = h;
            cnt++;
            if(cnt === N) break;
        }
        if(cnt === N) break;
    }
    console.log(rH*100+rW);
}
0 를 눌러주세요! 행복해져요!

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다