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: 147ms
Memory: 1752kB
In contest: 1276

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