萌新求助!!
查看原帖
萌新求助!!
758530
dsxxsd楼主2023/2/1 21:49

只有4还是RE,剩下的都AC了。但是4的数据在本地能输出正确结果啊啊啊

#include<stdio.h>
#include<stdbool.h>
int main()
{
    bool place[23][23] ={0};
    int hx;//马的X坐标
    int hy;//马的Y坐标
    int bx;//B点Y坐标
    int by;//B点x坐标
    long long n_place[23][23] ={0};
    scanf("%d %d %d %d", &bx, &by, &hx, &hy);

    place[hx][hy] = 1;
    place[hx - 2][hy-1] = 1;
    place[hx - 2][hy+1] = 1;
    place[hx + 2][hy-1] = 1;
    place[hx + 2][hy+1] = 1;
    place[hx - 1][hy-2] = 1;
    place[hx - 1][hy+2] = 1;
    place[hx + 1][hy-2] = 1;
    place[hx + 1][hy+2] = 1;
    for (int nx = 0; nx <= bx;++nx)
    {
        for (int ny = 0; ny <= by;++ny)
        {
            if (!place[nx][ny])
            {
                if (nx == 0 && ny == 0)
                    n_place[0][0] = 1;
                else if (nx == 0 && ny > 0)
                    n_place[0][ny] = n_place[0][ny - 1];
                else if (nx > 0 && ny == 0)
                    n_place[nx][0] = n_place[nx-1][0];
                else
                    n_place[nx][ny] = n_place[nx - 1][ny] + n_place[nx][ny - 1];
            }
        }
    }
    printf("%lld", n_place[bx][by]);
    return 0;
}
2023/2/1 21:49
加载中...