Accepted
代码
#include <iostream>
#include<cstring>
using namespace std;
const int maxn=100005;
int ans[maxn];
int main() {
memset(ans,0,sizeof(ans));
for(int i=1;i<maxn;i++){
int x=i,y=i;
while(x>0){
y+=x%10;
x/=10;
}
if(ans[y]==0||i<ans[y]) ans[y]=i;
}
int n;
cin>>n;
cout<<ans[n];
return 0;
}