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: 56ms
Memory: 2104kB
In contest: 1276

#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<cstring>
using namespace std;
const int maxn=1e5+100;
const int inf=0x3f3f3f3f;
int a[maxn];
int ss(int k){
	if(k>81&&k<=100) return 100;
	else if(k>64&&k<=81) return 90;
	else if(k>49&&k<=64) return 80;
	else if(k>36&&k<=49) return 70;
	else if(k>25&&k<=36) return 60;
	else if(k>16&&k<=25) return 50;
	else if(k>9&&k<=16) return 40;
	else if(k>4&&k<=9) return 30;
	else if(k>1&&k<=4) return 20;
	else return 10;
}
int main(){
	int n,k;
	int kk=ceil(sqrt(10.0));
	scanf("%d %d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(k>=5) a[i]=100;
		else {
			for(int j=0;j<k;j++){
				a[i]=ss(a[i]);
				if(a[i]==100) break; 
			}
		}
	}
	for(int i=0;i<n;i++) printf("%d%c",a[i]," \n"[i==n-1]);
}