E

[https://vjudge.net/contest/220165#problem/E]

#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int a[maxn];
int main(){
	int t,n;
	memset(a,0,sizeof(a));
	for(int j=1;j<maxn;j++){
		int x=j,y=j;
		while(x){
			y+=x%10;
			x/=10;
		}
		if(a[y]==0||j<a[y])
		a[y]=j;
			}
			cin>>t;
			while(t--){
				cin>>n;
				cout<<a[n]<<endl;
			}
	return 0;
}
posted @ 2018-07-30 17:32  ChunhaoMo  阅读(96)  评论(0)    收藏  举报