티스토리 뷰

 

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

//https://www.acmicpc.net/problem/14494
const [r, c] = require('fs').readFileSync('./dev/stdin').toString().trim().split(' ').map(Number);
const dp = Array.from(new Array(r), () => new Array(c).fill(1));
const MOD = 1_000_000_007;
for (let i = 1; i < r; i++) {
	for (let j = 1; j < c; j++) {
		dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] + dp[i - 1][j - 1]) % MOD;
	}
}
console.log(dp[r - 1][c - 1]);
728x90
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
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 31
글 보관함