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: 50ms
Memory: 2108kB
In contest: 1276

#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);
	}
}