29.1227

时间:2022-11-28 22:59:33

#include<stdio.h>


int main()

{

int i,j,n,a[50],b[50],k,l,m;

scanf("%d",&n);

for(i=0;i<n;i++)

{scanf("%d%d",&a[i],&b[i]);

}

for(i=0;i<n;i++)

{for(j=1;j<b[i]*a[i];j++)

{for(k=1;k<=a[i];k++)

{if(j%a[i]==0&&j!=b[i]*a[i])j++;

l=j%a[i];

if(k==l||k==a[i]-l+1)

{printf("X");

}

else printf(" ");

}printf("\n");

 

}if(j==b[i]*a[i])

{for(m=1;m<=a[i];m++)

{if(m==1||m==a[i])printf("X");

else printf(" ");

}printf("\n");

}printf("\n");

}

return 0;

}

相关文章