Start: Jun, 28, 2019 08:42:00
2019杭州师范大学第一届程序设计竞赛新生赛
End: Jun, 28, 2019 11:42:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 299ms
Memory: 1900kB
In contest: 1276

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	int n,k,i,j,m;
	double *a;
	double b[101];
	scanf("%d%d",&n,&k);
	a=(double *)malloc(n*sizeof(double));
	memset(b,0,sizeof(b));
	for(i=0;i<n;++i)
		scanf("%lf",&a[i]);
	m=a[0];
	for(i=1;i<=k;++i)
		a[0]=10*ceil(sqrt(a[0]));
	printf("%.0f ",a[0]);
	b[m]=a[0];
	for(i=1;i<n;++i)
	{
		m=a[i];
		if(b[m]!=0)
			a[i]=b[m];
		else
		{
		     for(j=1;j<=k;++j)
		     {
			      a[i]=10*ceil(sqrt(a[i]));
		      }
			 b[m]=a[i];
		}
		if(i!=n-1)
			printf("%.0f ",a[i]);
		else 
			printf("%.0f\n",a[i]);
	}
	return 0;
}