只有最后一个10分...没有数据点不知道哪里错了....
查看原帖
只有最后一个10分...没有数据点不知道哪里错了....
343886
爱兔兔爱兔兔楼主2020/5/7 21:48

.

include<stdio.h>



int main()
{   int a[800][800];
    int c[800][800];
    int magic, size;
    scanf("%d%d", &size, &magic);

    int m = 1, i, j,n;
    for (i = 1; i <= size; i++)
        for (j = 1; j <= size; j++)
        {
            a[i][j] = m;
            m=m+1;
        }
    for (i = 0; i < magic; i++)
    {
        int x, y, r, z;
        scanf("%d%d%d%d", &x, &y, &r, &z);
        int i, j;
         m = x - r, n = y - r;
        for (i = 1, m = x - r; i <= 2*r+1; i++, m++)
        {
            for (j = 1, n = y - r; j <= 2*r+1; j++, n++)
            {
                c[i][j] = a[m][n];
            }
        }

        if (z == 0)
        {
            for (m = x - r, i = 1; i <= 2*r+1; i++, m++)
                for (n = y - r , j = 2*r+1; j >= 1; j--, n++)
                {
                    a[m][n] = c[j][i];
                }

        }
        if (z == 1)
        {   
            for (m = x - r, i = 1; i <= 2 * r + 1; i++, m++)
                for (n = y - r, j = 2 * r + 1; j >= 1; j--, n++)
                {
                    a[n][m] = c[i][j];
                }
        }
    }


    for (i = 1; i <= size; i++)
    {
        for (j = 1; j <= size; j++)
        {
            printf("%d ", a[i][j]);
        }
        printf("\n");
    }

    return 0;
}
2020/5/7 21:48
加载中...