帮看看这是什么错?我刚学c语言

foo.c:2:1: warning: missing braces around initializer [-Wmissing-braces] 

foo.c:2:1: warning: (near initialization for 'father[0]') [-Wmissing-braces] 

foo.c:2:1: warning: missing braces around initializer [-Wmissing-braces] 

foo.c:2:1: warning: (near initialization for 'op[0]') [-Wmissing-braces] 

foo.c:3:1: warning: missing braces around initializer [-Wmissing-braces] 

foo.c:3:1: warning: (near initialization for 'room[0]') [-Wmissing-braces] 

foo.c:3:1: warning: missing braces around initializer [-Wmissing-braces] 

foo.c:3:1: warning: (near initialization for 'map[0]') [-Wmissing-braces] 

foo.c: In function 'findpapa': 

foo.c:43:5: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat] 

foo.c: In function 'main': 

foo.c:50:11: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long int *' [-Wformat] 

foo.c:50:11: warning: format '%d' expects argument of type 'int *', but argument 3 has type 'long int *' [-Wformat] 

foo.c:54:17: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long int *' [-Wformat] 

foo.c:89:23: warning: 'p' may be used uninitialized in this function [-Wuninitialized] 

├ 测试数据 01:答案正确... (0ms, 972KB) 

├ 测试数据 02:运行时错误... (0ms, 980KB) 

读取访问违规, 地址: 0x00000003 

├ 测试数据 03:运行时错误... (0ms, 980KB) 

读取访问违规, 地址: 0x00000003 

├ 测试数据 04:运行时错误... (0ms, 964KB) 

读取访问违规, 地址: 0x00000003 

├ 测试数据 05:运行时错误... (0ms, 964KB) 

读取访问违规, 地址: 0x00000003 

├ 测试数据 06:答案正确... (0ms, 972KB) 

├ 测试数据 07:答案正确... (0ms, 972KB) 

├ 测试数据 08:答案正确... (0ms, 972KB) 

├ 测试数据 09:运行时错误... (0ms, 964KB) 

读取访问违规, 地址: 0x00000003 

---|---|---|---|---|---|---|---|-

Unaccepted / 44 / 0ms / 972KB 

2 条评论

  • @ 2012-10-19 11:34:23

    看评测机的报错有输出是%d即int型,而你可能定义的是longint。。。其他的中文空格太多。。。懒得看。。。

  • @ 2012-10-15 23:21:32

    这是程序,算法应该没错,这烦人的语法

    01

    #include

    02

    long  father[100][500]={0},op[100][500]={0};

    03

    long room[100][500]={0},map[100][500]={0};

    04

    int pointleft(long a,long b);

    05

    int pointright(long a,long b);

    06

    int pointdown(long a,long b);

    07

    int findpapa(long a,long b);

    08

       int pointleft(long a,long b)  

    09

       {    

    10

         if ((op[a]==0)&&(map[a]!=0))   

    11

         {

    12

             father[a]=1;

    13

             room[a]=map[a]+room[a];

    14

         }

    15

         return(0);

    16

        }

    17

       int pointright(long a,long b)

    18

       {

    19

          if ((op[a]==0)&&(map[a]!=0))

    20

          {

    21

            father[a]=2;

    22

            room[a]=map[a]+room[a];

    23

         }

    24

        return(0);

    25

        }

    26

       int pointdown(long a,long b)

    27

       {

    28

          if ((op[a+1]==0)&&(map[a+1]!=0))

    29

        {

    30

             father[a+1]=3;

    31

             room[a+1]=map[a+1]+room[a];

    32

         }

    33

        return(0);

    34

        }

    35

        int findpapa(long a,long b)

    36

         {

    37

           if (father[a]==1)

    38

              findpapa(a,b+1);

    39

           if (father[a]==2)

    40

             findpapa(a,b-1);

    41

           if (father[a]==3)

    42

             findpapa(a-1,b);

    43

           printf("%d\n",b);

    44

            return(0);

    45

         }

    46

      int  main()

    47

         {

    48

            long m,n,i,j,k;

    49

            long min,p;

    50

              scanf("%d%d",&m,&n);

    51

              for (i=1;i

  • 1

信息

ID
1139
难度
7
分类
动态规划 点击显示
标签
递交数
5206
已通过
858
通过率
16%
被复制
7
上传者