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: 68ms
Memory: 1860kB
In contest: 1276

#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
	int T,i,k;
	double a[110000],m,flag=1;
	long long n;
	scanf("%d %d",&T,&k);
	for(i=0;i<T;++i)
	{
		scanf("%lf",&a[i]);
	}
	while(k--)
	{
		flag=0;
		for(i=0;i<T;++i)
		{
			if(a[i]!=100)
			{
				flag=1;
			}
		}
		if(flag==1)
		{
			for(i=0;i<T;++i)
			{
				if(a[i]==100)
				{
					continue;
				}
				m = sqrt(a[i]);
				m = ceil(m);
				m *= 10;
				a[i] = m;
			}
		}
		else if(flag==0)
		{
			break;
		}
	}
	for(i=0;i<T;++i)
	{
		n = (int)a[i];
		printf("%d",n);
		if(i<T-1)
		{
			printf(" ");
		}
	}
	printf("\n");
}