C语言,全WA了,不理解了
查看原帖
C语言,全WA了,不理解了
1027350
Etayo楼主2023/8/24 10:58
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,q;
    scanf("%d %d %d\n",&a,&b,&c);
    scanf("%d",&q);
    int x[6][100],k[20][20][20];
    for(int i=0;i<6;i++)
    {
        for(int j=0;j<q;j++)
        {
            scanf("%d",&x[i][j]);
        }
    }
    for(int d=0;d<a;d++)
    {
        for(int e=0;e<b;e++)
        {
            for(int f=0;f<c;f++)
            {
                k[d][e][f]=0;
            }
        }
    }
    for(int j=0;j<q;j++)
    {
        for(int d=x[0][j];d<=x[4][j];d++)
        {
           for(int e=x[1][j];e<=x[5][j];e++)
           {
               for(int f=x[2][j];f<=x[6][j];f++)
               {
                   k[d][e][f]=1;
               }
           }
        }
    }
    int count=0;
    for(int d=0;d<a;d++)
    {
        for(int e=0;e<b;e++)
        {
            for(int f=0;f<c;f++)
            {
                if(k[d][e][f]=1)
                {
                    count++;
                }
            }
        }
    }
    int ans=a*b*c-count;
    printf("%d",ans);
    return 0;
}
2023/8/24 10:58
加载中...