题解 | #走方格的方案数#
走方格的方案数
http://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
你以为是寻路?
其实就是选择。
答案 =
while (line = readline()) {
let nums = line.split(" ");
let col = +nums[0];
let row = +nums[1];
let num = col + row;
let ans1 = 1;
for (let i = 0; i < col; i++) {
ans1 *= num;
num--;
}
let ans2 = 1;
for (let i = 1; i <= col; i++) {
ans2 *= i;
}
let ans = ans1 / ans2;
console.log(ans);
}
途虎公司福利 103人发布