HUST Online Judge WebBoard
Problem 4091 >> 格式错误
201803140233 @ 2019-04-23 21:17:01
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
void fun(int n,int a[20],int b[20],int c[20],int x,int y)
{
int i,num,max=0,j,k,p;
for(i=1;i<=n;i++)
{
num=a[i]+b[i]*(c[i]-1);
if(num>max)
max=num;
}
for(p=1;p<=n;p++)
{
k=(max-a[p])/2;
for(j=1;j<=c[p];j++)
{
for(i=1;i<=k;i++)
printf(" ");
for(i=k+1;i<=k+a[p]+b[p]*(j-1);i++)
printf("*");
k=k-2;
printf("\n");
}

}
j=(max-y)/2;
while(x--)
{
for(i=1;i<=j;i++)
printf(" ");
for(i=j+1;i<=j+y;i++)
printf("*");
printf("\n");
}
}
int main()
{
int n,a[20],b[20],c[20],x,y;
int i=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d %d %d",&a[i],&b[i],&c[i]);
scanf("%d %d",&x,&y);
fun(n,a,b,c,x,y);
return 0;
}