RenHao

eTutor_10

Sep 30th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define MAX_SZ 1000
  4. int SeparateIsland = 0,BiggestIsland = 0;
  5. int TraverseMap(char *A[], int m, int n)
  6. {
  7.     int i=0,j=0;
  8.     for(;i<m;i++)
  9.     {
  10.         for(;j<n;j++)
  11.         {
  12.            
  13.         }
  14.     }
  15. }
  16. int SearchEight(char *A[], int index_i, int index_j)
  17. {
  18.     int i=0,j=0;
  19.     for(i=index_i-1; i<=index_i+1; i++)
  20.     {
  21.         for(j=index_j-1; j<=index_j+1; j++)
  22.         {
  23.             if( A[i][j] == '#' )    BiggestIsland++;
  24.         }
  25.     }
  26.     BiggestIsland--;    //(i,j) must be repeated
  27.     if(BiggestIsland == 1)  return -1;  //No one nearby
  28.     else    return 0;
  29. }
  30. int main(int argc, const char * argv[])
  31. {
  32.     int m=0,n=0,cnt=0;
  33.     scanf("%d %d",&m,&n);
  34.     char Island[MAX_SZ][MAX_SZ];
  35.     while(cnt<n)
  36.         scanf("%s",Island[cnt++]);
  37.    
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment