티스토리 뷰

 

https://www.acmicpc.net/problem/24418

 

//https://www.acmicpc.net/problem/24418
const input = require('fs')
	.readFileSync('./dev/stdin')
	.toString()
	.trim()
	.split('\n')
	.map((v) => v.split(' ').map(Number));

const N = input.shift()[0];
let count = 0;
input.unshift(new Array(N).fill(0));

const arr = input.map((v) => [0, ...v]);

function test(arr, n, m) {
	if (n == 0 || m == 0) {
		count++;
		return 0;
	} else return arr[n][m] + Math.max(test(arr, n - 1, m), test(arr, n, m - 1));
}

test(arr, N, N);
console.log(count, N * N);
728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
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 29 30
글 보관함