#include<bits/stdc++.h>
using namespace std;
int g(int n) {
int ans = n;
while (n) {
ans += n % 10;
n /= 10;
}
return ans;
}
int num(int n) {
int c = 0;
while (n) {
n /= 10;
c++;
}
return c;
}
int main() {
int n, i, t;
cin>>t;
for (int j = 0; j < t; j++){
cin>>n;
i = n - 9 * num(n);
for (; i < n; i++)
if (g(i) == n)
break;
if (i != n)
cout<<i<<endl;
else
cout<<"0"<<endl;
}
return 0;
}
04-08
772
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-08
3165
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-28
07-28