반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 그래프
- HTTP 완벽 가이드
- 타입스크립트
- 문자열
- 수학
- TCP
- Nestjs
- ip
- 프로그래머스
- dfs
- 가천대
- 알고리즘
- 백준
- 소켓
- 쉬운 문제
- 레벨 1
- Algorithm
- BFS
- dp
- socket
- HTTP
- Crawling
- typescript
- javascript
- 타입 챌린지
- 프로그래머스 레벨 2
- Node.js
- 크롤링
- type challenge
- 자바스크립트
Archives
- Today
- Total
kakasoo
[node.js] 최댓값 ( 백준 2566번 ) 본문
반응형
// 백준 2566번 최댓값을 풀었습니다.
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let count = 9;
const input = [];
rl.on("line", (line) => {
if (!count) {
count = Number(line);
} else {
input.push(line);
if (input.length === count) {
main();
rl.close();
}
}
}).on("close", () => {
process.exit();
});
const main = () => {
const numbers = input.map((el) => el.split(" ").map(Number));
let maxValue = 0;
let maxY = 0;
let maxX = 0;
for (let i = 0; i < 9; i++) {
for (let j = 0; j < 9; j++) {
if (maxValue < numbers[i][j]) {
maxValue = numbers[i][j];
maxY = i;
maxX = j;
}
}
}
console.log(maxValue);
console.log(`${maxY + 1} ${maxX + 1}`);
};
반응형
'프로그래밍 > 알고리즘 풀이' 카테고리의 다른 글
[node.js] 대소문자 바꾸기 ( 백준 2744번 ) (0) | 2021.04.07 |
---|---|
[node.js] 홀수 ( 백준 2576번 ) (0) | 2021.04.06 |
[node.js] 점수 계산 ( 백준 2506번 ) (0) | 2021.04.06 |
[node.js] 주사위 세 개 ( 백준 2480번 ) (0) | 2021.04.06 |
[node.js] 지능형 기차 2 ( 백준 2460번 ) (0) | 2021.04.06 |