zoukankan      html  css  js  c++  java
  • 51 nod 机器人走方格

    从一个长方形的方格的右上角 走到 左下角 , 问一共有多少种不同的路线可以达到 .

     1 #include<stdio.h>
     2 #include<string.h>
     3 #include<math.h>
     4 #include<iostream>
     5 #include<algorithm>
     6 #include<queue>
     7 #include<vector>
     8 #include<set>
     9 #include<stack>
    10 #include<string>
    11 #include<sstream>
    12 #include<map>
    13 #include<cctype>
    14 #include<limits.h>
    15 using namespace std;
    16 #define leng 1005
    17 long long dp[leng][leng];
    18 int main()
    19 {
    20     int n,m;
    21     while(~scanf("%d%d",&n,&m))
    22     {
    23         memset(dp,0,sizeof(dp));
    24         for(int i = 1; i <= n; i ++)
    25             for(int j = 1; j <= m; j ++)
    26                 if(i == 1 && j == 1)
    27                     dp[i][j] = 1;
    28                 else
    29                     dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
    30         printf("%d
    ",dp[n][m]);
    31     }
    32 }

     

  • 相关阅读:
    request内置对象
    JSP页面、包含
    HTTP协议
    html简介
    数据访问层工具类
    数据运算
    可变于不可变对象分类
    有序 无序 的区别
    字符串方法
    day01_final
  • 原文地址:https://www.cnblogs.com/A-FM/p/5546567.html
Copyright © 2011-2022 走看看