Result: Accepted
Time: 69ms
Memory: 1480kB
#include<cstdio>
#include<set>
#include<vector>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
int a[maxn];
int f(int x){
if(x==1)
return 10;
else if(x>=2&&x<=4)
return 20;
else if(x>=5&&x<=9)
return 30;
else if(x>=10&&x<=16)
return 40;
else if(x>=17&&x<=25)
return 50;
else if(x>=26&&x<=36)
return 60;
else if(x>=37&&x<=49)
return 70;
else if(x>=50&&x<=64)
return 80;
else if(x>=65&&x<=81)
return 90;
else if(x>=82&&x<=100)
return 100;
}
int main(){
int n,k;
while(~scanf("%d%d",&n,&k)){
for(int i=1;i<=n;i++)
scanf("%d",a+i);
bool flag;
while(k--){
flag=1;
for(int i=1;i<=n;i++){
if(a[i]!=f(a[i]))
flag=0;
a[i]=f(a[i]);
}
if(flag)
break;
}
for(int i=1;i<=n;i++){
printf("%d",a[i]);
if(i!=n)printf(" ");
}
printf("\n");
}
}