60分;3,4俩测试点WA,其它AC
查看原帖
60分;3,4俩测试点WA,其它AC
1094233
HZT1121楼主2024/7/26 14:10
// P1002过河卒
# include <cstdio>
# include <cstring>
using namespace std;

int n, m, hx, hy;
long long a[50][50];

int main(){
    scanf("%d %d %d %d", &n, &m, &hx, &hy);

    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j <= m; j++) a[i][j] = 1;
    }

    a[hx][hy] = 0;
    if(hy - 1 >= 0) a[hx + 2][hy - 1] = 0;
    a[hx + 2][hy + 1] = 0;
    if(hx - 1 >= 0 && hy - 2 >= 0) a[hx - 1][hy - 2] = 0;
    if(hx - 1 >= 0) a[hx - 1][hy + 2] = 0;
    if(hy - 2 >= 0) a[hx + 1][hy - 2] = 0;
    a[hx + 1][hy + 2] = 0;
    if(hx - 2 >= 0 && hy - 1 >= 0) a[hx - 2][hy - 1] = 0;
    if(hx - 2 >= 0) a[hx - 2][hy + 1] = 0;

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(a[i][j] == 0) continue;
            a[i][j] = a[i - 1][j] + a[i][j - 1];
            printf("%d %d %d\n", i, j, a[i][j]);
        }
    }
    
    printf("%ld", a[n][m]);
    return 0;
}
2024/7/26 14:10
加载中...