Result: Accepted
Time: 83ms
Memory: 2012kB
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<map>
#include<set>
#include<queue>
#include<vector>
using namespace std;
int main()
{
int n,m,T,k,x,y,a[100010],ans[20];
char s[60];
//scanf("%d",&);
//printf("hello\n");
scanf("%d %d",&n,&k);
for(int q=1;q<=10;q++){
int t=q*q;
for(int i=1;i<=k;i++){
double w=sqrt(t);
int ww=w;
if(ww*ww!=w*w) t=10*(ww+1);
else t=10*ww;
}
ans[q]=t;
}
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
if(a[i]==1) printf("%d ",ans[1]);
else if(a[i]>1&&a[i]<=4) printf("%d ",ans[2]);
else if(a[i]>4&&a[i]<=9) printf("%d ",ans[3]);
else if(a[i]>9&&a[i]<=16) printf("%d ",ans[4]);
else if(a[i]>16&&a[i]<=25) printf("%d ",ans[5]);
else if(a[i]>25&&a[i]<=36) printf("%d ",ans[6]);
else if(a[i]>36&&a[i]<=49) printf("%d ",ans[7]);
else if(a[i]>49&&a[i]<=64) printf("%d ",ans[8]);
else if(a[i]>64&&a[i]<=81) printf("%d ",ans[9]);
else if(a[i]>81&&a[i]<=100) printf("%d ",ans[10]);
}
}