zoukankan      html  css  js  c++  java
  • Code Vs 1010 过河卒

    [Uncompleted]

    http://codevs.cn/problem/1010/

    #include <stdio.h>
    #include<string.h>
    #define x 0
    #define y 1
    int map[20][20];
    void Print(int h[][2])
    {
        int i;
        for(i=0;i<9;i++)
        {
            printf("%d %d ",h[i][x],h[i][y]);
        }
    }
    int main()
    {
        int bn,bm;
        int h[2];
        memset(map,0,20*20);
        
        scanf("%d%d",&bn,&bm);
        scanf("%d%d",&h[x],&h[y]);
        
        map[h[x]][h[y]]=-1;
        map[h[x]+2][h[y]+1]=-1;
        map[h[x]+2][h[y]-1]=-1;
        map[h[x]+1][h[y]-2]=-1;
        map[h[x]-1][h[y]-2]=-1;
        map[h[x]-2][h[y]-1]=-1;
        map[h[x]-2][h[y]+1]=-1;
        map[h[x]-1][h[y]+2]=-1;
        map[h[x]+1][h[y]+2]=-1;
        
        int i,j;
        map[0][0]=1;
        for(i=0;i<=bn;i++)
        {
            for(j=0;j<=bm;j++)
            {
                if(map[i][j]==-1)continue;
                if(j>0&&map[i][j-1]!=-1)map[i][j]+=map[i][j-1];
                if(i>0&&map[i-1][j]!=-1)map[i][j]+=map[i-1][j];
            }
        }
        int ans=map[bn][bm];
        printf("%d ",ans);
        return 0;
    }

  • 相关阅读:
    类数组及其转换
    数组去重
    ios UIView
    ios 解决Wkwebview闪烁问题
    ios Https问题
    UUID
    JavaScript4
    JavaScript2
    JavaScript1
    UIScollView
  • 原文地址:https://www.cnblogs.com/CXSheng/p/4926362.html
Copyright © 2011-2022 走看看