char str[50][10];
void Amplitude(int a)
{
char substr[10];
int k=0,i,j;
for(i=0;i<a;i++)
{
for(j=0;j<=i;j++)
sprintf(&substr[k++],"%d",i+1);
sprintf(str[i],"%s\n",substr);
k=0;
}
}
int main()
{
register int i,j;
int a,f,n;
//freopen("in.txt","r",stdin);
scanf("%d",&n);
while(n)
{
scanf("%d%d",&a,&f);
Amplitude(a);
for(j=1;j<=f;j++)
{
for(i=0;i<a;i++)
printf(str[i]);
for(i=a-2;i>=0;i--)
printf(str[i]);
if(j!=f)printf("\n");
}
n--;
if(n)printf("\n");
}
return(0);
}
No comments:
Post a Comment