Result: Accepted
Time: 61ms
Memory: 2132kB
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int p[maxn];
int main(){
int n,k;
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++){
scanf("%d",&p[i]);
if(k!=1){
int x=k;
while(x--){
if(p[i]==100)break;
p[i]=10*(int)(sqrt(p[i])+0.9999999);
}
}
}
if(k==1){
for(int i=0;i<n;i++){
printf("%d",(int)(sqrt(p[i])+0.99999)*10);
if(i==n-1)printf("\n");
else printf(" ");
}
return 0;
}
for(int i=0;i<n;i++){
printf("%d",p[i]);
if(i==n-1)printf("\n");
else printf(" ");
}
return 0;
}