Advertisement
Nayeemzaman

Untitled

Nov 5th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int t,n,m,i,j,k,r,c,p;
  5. scanf("%d",&t);
  6. for(i=0;i<t;i++)
  7. {
  8. scanf("%d %d %d",&n,&m,&p);
  9. int ch1[n+5][m+5],ch2[n+5][m+5];
  10. for(r=1;r<=n;r++)
  11. {
  12. for(c=1;c<=m;c++)
  13. {
  14. scanf("%d",&ch1[r][c]);
  15. }
  16. }
  17. for(j=1;j<=p;j++)
  18. {
  19. for(r=1;r<=m;r++)
  20. {
  21. for(c=1;c<=m;c++)
  22. {
  23. if(ch1[r][c]==1)
  24. {
  25. ch2[r+j][c]==1;
  26. ch2[r-j][c]==1;
  27. ch2[r][c+j]==1;
  28. ch2[r][c-j]==1;
  29. }
  30. }
  31. }
  32. }
  33. for(r=1;r<=n;r++)
  34. {
  35. for(c=1;c<=m;r++)
  36. {
  37. ch1[r][c]=ch2[r][c];
  38. }
  39. }
  40. printf("case #%d:\n",i+1);
  41. for(r=1;r<=n;r++)
  42. {
  43. for(c=1;c<=m;c++)
  44. {
  45. printf("%d",ch1[r][c]);
  46. }
  47. printf("\n");
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement