fork download
  1. /*
  2.  
  3. /**
  4.  * author: Phatsbell
  5.  * vnoi: https://o...content-available-to-author-only...i.info/user/ChiPhatNguyen
  6. **/
  7.  
  8.  
  9. #include <bits/stdc++.h>
  10. using namespace std;
  11. #define int long long
  12. #define pb push_back
  13. #define fi first
  14. #define se second
  15. #define all(v) (v).begin(), (v).end()
  16. #define rall(v) (v).rbegin(), (v).rend()
  17. #define sz(x) (int)(x).size()
  18. #define pii pair<int,int>
  19.  
  20. const int INF = 1e18;
  21. const int MOD = 1e9+7;
  22. const int MAXN = 1e6+5;
  23. // const int MOD = 998244353;
  24. int a[MAXN];
  25. void fastIO(){
  26. ios::sync_with_stdio(0);
  27. cin.tie(0);
  28. }
  29. bool kt(int n){
  30. int tmp = n;
  31. while (tmp > 0){
  32. int d = tmp%10;
  33. if (d == 0 || n % d != 0) return false;
  34. tmp/=10;
  35. }
  36. return true;
  37. }
  38. main(){
  39. FILE *f = fopen("SELFDIV.INP", "r");
  40. if(f){
  41. fclose(f);
  42. freopen("SELFDIV.INP", "r", stdin);
  43. freopen("SELFDIV.OUT", "w", stdout);
  44. }
  45. fastIO();
  46. int L,R;
  47. cin>>L>>R;
  48. int gay = 0;
  49. int dem = 0;
  50. for(int i = L;i<=R;i++){
  51. if(kt(i)) dem++;
  52. }
  53. cout<<dem<<"\n";
  54. for(int i = L;i<=R;i++){
  55. if(kt(i)) cout<<i<<" ";
  56. }
  57. return 0;
  58. }
  59.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
0