typedef struct POINT

{

    int x, y;

    POINT() {}

    POINT(int x, int y) { this->x = x, this->y = y; }

} POINT;


    ...


    int     haystack[HEIGHT][WIDTH];

    int     center_x, center_y;

    int     x, y;

    POINT   map[8];

    int     needle_count = 0;

    int     needle;


    ...


    //  무분기 버전

    //  0 1 2

    //  3 4 5  여기서 4 의 위치가 center_x, center_y

    //  6 7 8


    x = center_x - 1;

    y = center_y - 1;

    map[needle_count] = POINT( x, y ); // 0

    needle_count += haystack[y][x] == needle;


    map[needle_count] = POINT( x, center_y ); // 3

    needle_count += haystack[center_y][x] == needle;


    map[needle_count] = POINT( center_x, y ); // 1

    needle_count += haystack[y][center_x] == needle;


    x = center_x + 1;

    map[needle_count] = POINT( x, y ); // 2

    needle_count += haystack[y][x] == needle;


    map[needle_count] = POINT( x, center_y ); // 5

    needle_count += haystack[center_y][x] == needle;


    y = center_y + 1;

    map[needle_count] = POINT( x, y ); // 8

    needle_count += haystack[y][x] == needle;


    map[needle_count] = POINT( center_x, y ); // 7

    needle_count += haystack[y][center_x] == needle;


    x = center_x - 1;

    map[needle_count] = POINT( x, y ); // 6

    needle_count += haystack[y][x] == needle;


쉽죠~