题目
import java.util.Scanner;
public class Main {
public static int func(int res) {
int sum = 0;
while(res!=0) {
int s = res%10;
sum+=s;
res/=10;
}
return sum;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while(t!=0) {
int n = sc.nextInt();
sc.nextLine();
int res = 1;
int sum = 0;
while(res<=n) {
if(res == n) {
System.out.println(sum);
break;
}
res = res+func(res);
sum++;
}
if(res>n) {
System.out.println("-1");
}
t--;
}
sc.close();
}
}