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: 104ms
Memory: 2300kB
In contest: 1276

#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int ax[100010];
int main (void){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",&ax[i]);
	}
	for(int i=0;i<n;i++){
		ax[i]=(int)pow((double)ceil(pow((double)ax[i],0.5)),2);
	}
	if(m==1){
		for(int i=0;i<n;i++){
			if(i==n-1){
				printf("%d\n",(int)(pow((double)ax[i],0.5)*10));
			}
			else printf("%d ",(int)(pow((double)ax[i],0.5)*10));
		}
	}
	else {
		for(int i=0;i<n;i++){
			for(int z=0;z<m;z++){
				ax[i]=ceil(pow((double)ax[i],0.5))*10;
				if(ax[i]==100) break;
			}
			if(i==n-1){
				printf("%d\n",ax[i]);
			}
			else {
				printf("%d ",ax[i]);
			}
		}
	}
}