题解 | #走方格的方案数#
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
#include <cstring> #include <iostream> using namespace std; int dp[10][10]; int main() { int m,n; cin>>m>>n; m++; n++; memset(dp, 0, sizeof(dp)); dp[1][1] = 1; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ if(i==1&&j==1)continue; dp[i][j] = dp[i-1][j]+dp[i][j-1]; } } cout<<dp[m][n]; } // 64 位输出请用 printf("%lld")