Result: Accepted
Time: 68ms
Memory: 1860kB
#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");
}