Advertisement
Raul_julian

Costa-[OBI]

Jun 17th, 2013
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     char matriz[1000][1000];
  6.     int  x, y, nl, nc, count=0, count1=0;
  7.    
  8.     scanf("%d %d", &nl, &nc);
  9.    
  10.         if(nl<0 || nl>1000 || nc<0 || nc>1000) return 0;
  11.  
  12.         for(x=0; x<nl; x++) scanf("%s", &matriz[x][0]);
  13.  
  14.         for(x=0; x<nl; x++) {  
  15.  
  16.             for(y=0; y<nc; y++) {
  17.  
  18.         if(matriz[x][y]=='#') {
  19.  
  20.  
  21.         if(matriz[x][y+1] == '.' || matriz[x][y-1] == '.' || matriz[x+1][y] == '.' || matriz[x-1][y] || '.') count++;  } } }
  22.    
  23.  
  24.     printf("%d", count);    
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement