Language: C++

Last login: Sat May 26 19:20:24 on ttys002
Risa-no-MacBook:~ Risa$ cd Desktop/
Risa-no-MacBook:Desktop Risa$ cd programming/
Risa-no-MacBook:programming Risa$ mkdir 0226
Risa-no-MacBook:programming Risa$ cd 0
0226/ 0416/ 0417/ 0423/ 0424/ 0501/ 0507/ 0508/ 0514/ 0515/ 0521/ 0522/ 
Risa-no-MacBook:programming Risa$ rmdir 0226/
Risa-no-MacBook:programming Risa$ mkdir 0528
Risa-no-MacBook:programming Risa$ cd 0528/
Risa-no-MacBook:0528 Risa$ emacs 0226.cpp





















Risa-no-MacBook:0528 Risa$ emacs 0226.cpp
Risa-no-MacBook:0528 Risa$ emacs 0064.cpp
Risa-no-MacBook:0528 Risa$ emacs 0064.cpp
Risa-no-MacBook:0528 Risa$ emacs 0064.cpp
Risa-no-MacBook:0528 Risa$ cd ../
Risa-no-MacBook:programming Risa$ mkdir 0529
Risa-no-MacBook:programming Risa$ cd 0529
Risa-no-MacBook:0529 Risa$ emacs 0533.cpp
Risa-no-MacBook:0529 Risa$ emacs 0071.cpp





#include <iostream>
using namespace std;
char g[8][8];

void solve(int a, int b) {
  g[a][b] = '0';
  for(int i = 1; i <= 3; i++) {
    if(a+i < 8 && g[a+i][b] == '1') {
      g[a+i][b] = '0';
      solve(a+i, b);
    }
    if(a-i >= 0 && g[a-i][b] == '1') {
      g[a-i][b] = '0';
      solve(a-i, b);
    }
    if(b+i < 8 && g[a][b+i] == '1') {
      g[a][b+i] = '0';
      solve(a, b+i);
    }
    if(b-i >= 0 && g[a][b-i] == '1') {
      g[a][b-i] = '0';
      solve(a, b-i);
    }
  }
}

int main() {
  int n, X, Y;
  int k = 0;

  cin >> n;

  while(n > k) {
    for(int i = 0; i < 8; i++) {
      for(int j = 0; j < 8; j++) {
        cin >> g[i][j];
      }
    }
    cin >> X >> Y;
    X--; Y--;

    solve(Y, X);

    cout << "Data " << (k+1) << ':' << endl;
    for(int i = 0; i < 8; i++) {
      for(int j = 0; j < 8; j++) {
        cout << g[i][j];
      }
      cout << '\n';
    }
    k++;
  }

  return 0;
}



Compiler output:
a.cc:6:43: error: invalid digit "8" in octal constant
    6 | 0226/ 0416/ 0417/ 0423/ 0424/ 0501/ 0507/ 0508/ 0514/ 0515/ 0521/ 0522/
      |                                           ^~~~
a.cc:8:41: error: invalid digit "8" in octal constant
    8 | Risa-no-MacBook:programming Risa$ mkdir 0528
      |                                         ^~~~
a.cc:9:38: error: invalid digit "8" in octal constant
    9 | Risa-no-MacBook:programming Risa$ cd 0528/
      |                                      ^~~~
a.cc:10:17: error: invalid digit "8" in octal constant
   10 | Risa-no-MacBook:0528 Risa$ emacs 0226.cpp
      |                 ^~~~
a.cc:32:17: error: invalid digit "8" in octal constant
   32 | Risa-no-MacBook:0528 Risa$ emacs 0226.cpp
      |                 ^~~~
a.cc:33:17: error: invalid digit "8" in octal constant
   33 | Risa-no-MacBook:0528 Risa$ emacs 0064.cpp
      |                 ^~~~
a.cc:34:17: error: invalid digit "8" in octal constant
   34 | Risa-no-MacBook:0528 Risa$ emacs 0064.cpp
      |                 ^~~~
a.cc:35:17: error: invalid digit "8" in octal constant
   35 | Risa-no-MacBook:0528 Risa$ emacs 0064.cpp
      |                 ^~~~
a.cc:36:17: error: invalid digit "8" in octal constant
   36 | Risa-no-MacBook:0528 Risa$ cd ../
      |                 ^~~~
a.cc:37:41: error: invalid digit "9" in octal constant
   37 | Risa-no-MacBook:programming Risa$ mkdir 0529
      |                                         ^~~~
a.cc:38:38: error: invalid digit "9" in octal constant
   38 | Risa-no-MacBook:programming Risa$ cd 0529
      |                                      ^~~~
a.cc:39:17: error: invalid digit "9" in octal constant
   39 | Risa-no-MacBook:0529 Risa$ emacs 0533.cpp
      |                 ^~~~
a.cc:40:17: error: invalid digit "9" in octal constant
   40 | Risa-no-MacBook:0529 Risa$ emacs 0071.cpp
      |                 ^~~~
a.cc:1:1: error: 'Last' does not name a type
    1 | Last login: Sat May 26 19:20:24 on ttys002
      | ^~~~
In file included from /usr/include/c++/14/iosfwd:42,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:46:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
   68 |   typedef ptrdiff_t     streamsize; // Signed integral type
      |           ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   40 | #include <cwchar> // For mbstate_t
  +++ |+#include <cstddef>
   41 | 
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/14/cwchar:44,
                 from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  132 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  134 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
  140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                             ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
  142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                               ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                    ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                      ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                                                    ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
  155 |   __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
      |                                                                         ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                          ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                                                    ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                                                      ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
  162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
  162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
      |                                                                      ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
  163 |   __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
      |