首页 > 其他分享 >29.1227

29.1227

时间:2022-11-28 23:01:39浏览次数:53  
标签:29.1227 int scanf 50 else printf j%

#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;

}

标签:29.1227,int,scanf,50,else,printf,j%
From: https://blog.51cto.com/u_15758636/5893773

相关文章