fork download
  1. /*
  2.   AOJ #0000
  3.   title:
  4.   @kankichi573
  5.  */
  6. #include <stdio.h>
  7. #include <string.h>
  8. char seat[102][102];
  9. char sit [102][102];
  10. int M,N;
  11.  
  12. int main()
  13. {
  14. int i,j,ret;
  15.  
  16. memset(sit,1,sizeof(sit));
  17. scanf("%d %d",&M,&N);
  18. for(i=1;i<=M;i++)
  19. for(j=1;j<=N;j++)
  20. scanf("%c",&seat[i][j]);
  21.  
  22. for(i=1;i<=M;i++)
  23. {
  24. for(j=1;j<=N;j++)
  25. printf("%c",seat[i][j]);
  26. printf("\n");
  27. }
  28.  
  29. for(j=1;j<=N;j++)
  30. seat[1][j]=0;
  31.  
  32. for(i=1;i<M;i++)
  33. for(j=1;j<N;j++)
  34. {
  35. if(seat[i][j]=='o' || seat[i][j]=='x')
  36. sit[i][j]=sit[i-1][j]=sit[i+1][j]=sit[i][j-1]=sit[i][j+1]=0;
  37. if(seat[i][j]=='x')
  38. sit[i-1][j-1]=sit[i-1][j+1]=sit[i+1][j-1]=sit[i+1][j+1]=0;
  39. }
  40. ret=0;
  41. for(i=1;i<M;i++)
  42. for(j=1;j<N;j++)
  43. ret += sit[i][j];
  44.  
  45. printf("%d\n",ret);
  46. return(0);
  47. }
  48.  
Success #stdin #stdout 0s 9448KB
stdin
5 5
-----
-----
-----
-----
-----
stdout
----
-
---
--
--
---
-
----

16