解题思路:
注意事项:
参考代码:#include
int main(){
int n[20],m[20],l,i,j,k,O=0;
scanf("%d",&l);
for(i=0;i
scanf("%d%d",&n[i],&m[i]);
}
while(l!=O){
while(m[O]>0){
for(i=(n[O]+1)/2;i>0;i--){
for(j=1;j<=(n[O]+1)/2-i;j++){
printf(" ");
}
for(k=1;k
if(k==1||k==i*2-1)
printf("X");
else
printf(" ");
}
printf("\n");
}
if(m[O]>1){
for(i=2;i
for(j=1;j<=(n[O]+1)/2-i;j++){
printf(" ");
}
for(k=1;k<=i*2;k++){
if(k==1||k==i*2-1)
printf("X");
else
printf(" ");
}
printf("\n");
}
} else{
for(i=2;i<=(n[O]+1)/2;i++){
for(j=1;j<=(n[O]+1)/2-i;j++){
printf(" ");
}
for(k=1;k<=i*2;k++){
if(k==1||k==i*2-1)
printf("X");
else
printf(" ");
}
printf("\n");
}
}
m[O]--;
}
printf("\n");
O++;
}
return 0;
}