fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. ios::sync_with_stdio(false);
  7. cin.tie(0);
  8.  
  9. int t; cin >> t;
  10.  
  11. while (t--) {
  12.  
  13.  
  14.  
  15. long long n; cin >> n;
  16. vector<long long> ans;
  17.  
  18. for (int i = 1; i <= 18; i++) {
  19.  
  20.  
  21. long long d = 1;
  22. for (int j = 0; j < i; j++){
  23. d*=10;
  24. }
  25.  
  26. d+=1; //maybe vul hoitache
  27.  
  28. if (n%d==0) ans.push_back(n/d);
  29. }
  30.  
  31. if (ans.empty()) cout << 0 << "\n";
  32. else {
  33. cout << ans.size() <<"\n";
  34.  
  35. for (auto x : ans) cout << x << " ";
  36. cout << "\n";
  37. }
  38. }
  39. }
  40.  
Success #stdin #stdout 0.01s 5284KB
stdin
5
1111
12
55
999999999999999999
1000000000000000000
stdout
2
101 11 
0
1
5 
3
90909090909090909 999000999000999 999999999 
0