๐ŸŽฒ๋ฐฑ์ค€ 2566๋ฒˆ ์ตœ๋Œ“๊ฐ’

Jeongeunยท2023๋…„ 1์›” 2์ผ
0

๋ฐฑ์ค€

๋ชฉ๋ก ๋ณด๊ธฐ
16/186

๋ฐฑ์ค€ 2566๋ฒˆ

์ฝ”๋“œ1

๐Ÿงธ ์ž…๋ ฅ๊ฐ’์„ ์ผ์ฐจ์› ๋ฐฐ์—ด๋กœ ๋งŒ๋“ค์–ด์„œ ํ’€์—ˆ๋‹ค

const fs = require('fs'); 
const input = fs.readFileSync('/dev/stdin').toString().split(/\n| /);

const max = Math.max(...input);

let row=0;

while(row < 81){
    for(let i = row; i < row+9; i++){
        if(input[i]===String(max)){
            console.log(max);
            console.log((row/9+1)+ ' '+(i-row+1));
        }
    }
    row+=9;
}

์ฝ”๋“œ2

๐Ÿงธ ์ด์ฐจ์› ๋ฐฐ์—ด์„ ์‚ด๋ ค์„œ..? ๋‹ค์‹œ ํ’€์–ด๋ดค๋‹ค.
๐Ÿ’Š ์ž…๋ ฅ๊ฐ’์ด ๋ชจ๋‘ 0์ผ ๊ฒฝ์šฐ๋ฅผ ์ƒ๊ฐํ•ด row, col๋ฅผ 1๋กœ ์ดˆ๊ธฐํ™”ํ•ด์ฃผ๊ฑฐ๋‚˜ max,temp ๋น„๊ตํ•  ๋•Œ ๋“ฑํ˜ธ๋ฅผ ๊ผญ ๋ถ™์—ฌ์•ผํ•œ๋‹ค!

const fs = require('fs'); 
const input = fs.readFileSync('/dev/stdin').toString().split('\n');

let max=0;
let row;
let col;

for(let i = 0; i < 9; i++){
 	//ํ•œ ํ–‰ ๊ตฌํ•˜๊ธฐ
    const data=input[i].split(' ').map((el)=>parseInt(el));
  
    //ํ•œ ํ–‰์—์„œ์˜ ์ตœ๋Œ“๊ฐ’
    const temp = Math.max(...data);
  
    if(max<=temp){
        max = temp;
        row = i+1; 
        col = data.indexOf(max)+1;
    }
    
}
console.log(max);
console.log(row+' '+col);

0๊ฐœ์˜ ๋Œ“๊ธ€