Result: Accepted
Time: 147ms
Memory: 1752kB
#include<iostream>
#include<cmath>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#define INF 0x3f3f3f3f
using namespace std;
char c[1000];
int n,t;
map<int,int>ma;
int solve(int num){
for(int i=1;i<=t;i++){
int flag=0;
if(ma[num]){
num=ma[num]*10;
}
else{
num=sqrt(num)+1;
num*=10;
}
if(num==100)
return 100;
}
return num;
}
int main(){
for(int i=1;i<=100;i++){
ma[i*i]=i;
}
scanf("%d %d",&n,&t);
int num=0;
for(int i=1;i<=n;i++){
scanf("%d",&num);
printf("%d",solve(num));
if(i!=n)
cout<<" ";
else
cout<<endl;
}
}