求教RE如何解决

P3613 【深基15.例2】寄包柜

peaceandlove2002 @ 2021-04-07 14:40:09

#include <stdio.h>
int main()
{
    int q,n;
    scanf("%d%d",&n,&q);

    while(q--){
        struct node{
        int a[100005];
    }box[n];
        int b,i,j,k;
        scanf("%d",&b);
        if(b==1){
            scanf("%d%d%d",&i,&j,&k);
            box[i].a[j]=k;
        }
        if(b==2){
            scanf("%d%d",&i,&j);
            printf("%d\n",box[i].a[j]);
        }

    }
}

by kkksc03 @ 2021-04-07 14:49:26

详见《深基》P206页


by expect @ 2021-04-07 15:09:28

大数组开main外面


by peaceandlove2002 @ 2021-04-12 14:40:05

@expect 谢谢啦


by ac_ac_ac_HHH @ 2021-12-02 11:01:41

这里为啥可以b[n],不是不能动态定义吗?那里必须是常量


|