Result: Accepted
Time: 50ms
Memory: 2108kB
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
#define ll long long
int a;
int s[maxn];
int main()
{
int n,k;
scanf("%d %d",&n,&k);
int b[15]={0,1,4,9,16,25,36,49,64,81,100};
for(int i=1;i<=100;i++)
{
for(int j=1;j<=10;j++)
{
if(i<=b[j])
{
s[i]=10*j;
break;
}
}
}
for(int i=1;i<=n;i++)
{
scanf("%d",&a);
if(i!=1) printf(" ");
if(k>=6)
{
printf("100");
continue;
}
for(int j=1;j<=k;j++)
{
a=s[a];
}
printf("%d",a);
}
}