답안 #17701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17701 2016-01-12T08:56:42 Z Elibay 최솟값 배열 (IZhO11_hyper) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define Fname "triangles"

using namespace std;


int a[40][40][40][40], x[40][40][40][40], n, m, i1, i2, i3, i4, j1, j2, j3, j4;

int main ()
{
    #ifdef Elibay
        freopen (".in", "r", stdin);
    #endif
    scanf ("%d%d", &n, &m);
    int w = n - m + 1;
    for (i1 = 1; i1 <= n; ++ i1)
    for (i2 = 1; i2 <= n; ++ i2)
    for (i3 = 1; i3 <= n; ++ i3)
    for (i4 = 1; i4 <= n; ++ i4)
        scanf ("%d", &a[i1][i2][i3][i4]),
        x[i1][i2][i3][i4] = a[i1][i2][i3][i4];
    for (i1 = 1; i1 <= w; ++ i1)
    for (i2 = 1; i2 <= w; ++ i2)
    for (i3 = 1; i3 <= w; ++ i3)
    for (i4 = 1; i4 <= w; ++ i4)
    for (j1 = i1; j1 <= i1 + m - 1; ++ j1)
    for (j2 = i2; j2 <= i2 + m - 1; ++ j2)
    for (j3 = i3; j3 <= i3 + m - 1; ++ j3)
    for (j4 = i4; j4 <= i4 + m - 1; ++ j4)
        x[i1][i2][i3][i4] = min (x[i1][i2][i3][i4], a[j1][j2][j3][j4]);
    for (i1 = 1; i1 <= w; ++ i1)
        for (i2 = 1; i2 <= w; ++ i2)
            for (i3 = 1; i3 <= w; ++ i3)
                for (i4 = 1; i4 <= w; ++ i4)
                    printf ("%d ", x[i1][i2][i3][i4]);
    return 0;
}

Compilation message

hyper.cpp:7:65: error: ‘int j1’ redeclared as different kind of symbol
 int a[40][40][40][40], x[40][40][40][40], n, m, i1, i2, i3, i4, j1, j2, j3, j4;
                                                                 ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/assert.h:35,
                 from /usr/include/c++/4.9/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/4.9/bits/stdc++.h:33,
                 from hyper.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:238:1: note: previous declaration ‘double j1(double)’
 __MATHCALL (j1,, (_Mdouble_));
 ^
hyper.cpp: In function ‘int main()’:
hyper.cpp:26:13: error: assignment of function ‘double j1(double)’
     for (j1 = i1; j1 <= i1 + m - 1; ++ j1)
             ^
hyper.cpp:26:13: error: cannot convert ‘int’ to ‘double(double) throw ()’ in assignment
hyper.cpp:26:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
     for (j1 = i1; j1 <= i1 + m - 1; ++ j1)
                                  ^
hyper.cpp:26:40: warning: ISO C++ forbids incrementing a pointer of type ‘double (*)(double) throw ()’ [-Wpointer-arith]
     for (j1 = i1; j1 <= i1 + m - 1; ++ j1)
                                        ^
hyper.cpp:26:40: error: lvalue required as increment operand
hyper.cpp:30:57: error: invalid types ‘int [40][40][40][40][double(double) throw ()]’ for array subscript
         x[i1][i2][i3][i4] = min (x[i1][i2][i3][i4], a[j1][j2][j3][j4]);
                                                         ^
hyper.cpp:14:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d", &n, &m);
                           ^
hyper.cpp:21:46: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         x[i1][i2][i3][i4] = a[i1][i2][i3][i4];
                                              ^