언젠가는 펼쳐 볼 아카이브
[BOJ] 2566번 - 최댓값 본문
사용언어 : javascript - node.js
#제출코드
const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
const input = fs
.readFileSync(filePath)
.toString()
.trim()
.split('\n')
.map((line) => line.split(' ').map((item) => +item));
solution(input);
function solution(input) {
let max = -1;
let x = 0;
let y = 0;
for (let i = 0; i < 9; i++) {
for (let j = 0; j < 9; j++) {
let value = input[i][j];
if (value >= max) {
max = value;
x = i + 1;
y = j + 1;
}
}
}
console.log(max);
console.log(`${x} ${y}`);
}
'IT > Baekjoon Oline Judge' 카테고리의 다른 글
[BOJ] 2563번 - 색종이 (0) | 2023.08.23 |
---|---|
[BOJ] 10798번 - 세로읽기 (0) | 2023.08.23 |
[BOJ] 2738번 - 행렬 덧셈 (0) | 2023.08.22 |
[BOJ] 25206번 - 너의 평점은 (0) | 2023.08.22 |
[BOJ] 1316번 - 그룹 단어 체커 (0) | 2023.08.22 |