Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int t,n,m,i,j,k,r,c,p;
- scanf("%d",&t);
- for(i=0;i<t;i++)
- {
- scanf("%d %d %d",&n,&m,&p);
- int ch1[n+5][m+5],ch2[n+5][m+5];
- for(r=1;r<=n;r++)
- {
- for(c=1;c<=m;c++)
- {
- scanf("%d",&ch1[r][c]);
- }
- }
- for(j=1;j<=p;j++)
- {
- for(r=1;r<=m;r++)
- {
- for(c=1;c<=m;c++)
- {
- if(ch1[r][c]==1)
- {
- ch2[r+j][c]==1;
- ch2[r-j][c]==1;
- ch2[r][c+j]==1;
- ch2[r][c-j]==1;
- }
- }
- }
- }
- for(r=1;r<=n;r++)
- {
- for(c=1;c<=m;r++)
- {
- ch1[r][c]=ch2[r][c];
- }
- }
- printf("case #%d:\n",i+1);
- for(r=1;r<=n;r++)
- {
- for(c=1;c<=m;c++)
- {
- printf("%d",ch1[r][c]);
- }
- printf("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement