intmain(){ //ios::sync_with_stdio(false); int i, num; while (cin >> N >> K) { if (N == -1 && K == -1) break; memset(map, 0, sizeof(map)); memset(vis, 0, sizeof(vis)); for (i = 0; i < N; i++) { cin >> map[i]; } ans = way = 0; DFS(0); cout << ans << endl; } return0; }
//#include <bits/stdc++.h>
/* #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include <queue> #include <stack> using namespace std; int n, m; char s[22][22]; int x, y; int ans; int vis[22][22]; int judge(int x, int y) { if (x < 1 || x > m || y < 1 || y > n) return 0; return 1; } void bfs(int x, int y) { if (vis[x][y] == 1 || !judge(x, y) || s[x][y] == '#') return; vis[x][y] = 1; ans++; bfs(x + 1, y); bfs(x - 1, y); bfs(x, y + 1); bfs(x, y - 1); } int main() { while (cin >> n >> m) { ans = 0; memset(vis, 0 ,sizeof vis); if (n == 0 && m == 0) break; //getchar(); for (int i = 1; i <= m; i++) { scanf("%s", s[i]); } //for (int j = 1; j <= n; j++) { // scanf("%c", &s[i][j]); // if (s[i][j] == '@') { // x = i; // y = j; // } //} //getchar(); for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { cout << s[i][j]; } cout << '\n'; } //bfs(x, y); //cout << ans << '\n'; } return 0; } */