Advertisement
JouJoy

O

Dec 12th, 2021
577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #define int long long
  4. using namespace std;
  5. int count1(int N)
  6. {
  7.     int res = 0;
  8.     while (N > 0)
  9.     {
  10.         res += (N / 5);
  11.         N /= 5;
  12.     }
  13.     return res;
  14. }
  15. main()
  16. {
  17.     int m, begin1, p = 0;
  18.     cin >> m;
  19.     for (int i = 1; i <= 1000000; i++)
  20.     {
  21.         if (count1(i) == m)
  22.         {
  23.             begin1 = i;
  24.             ++p;
  25.             break;
  26.         }
  27.         else if (count1(i) > m)
  28.             break;
  29.     }
  30.     if (p == 0)
  31.         cout << 0;
  32.     else
  33.     {
  34.         for (int i = begin1 + 6; i >= begin1 + 1; i--)
  35.         {
  36.             if (count1(i) == m)
  37.             {
  38.                 cout << i - begin1 + 1 << endl;
  39.                 for (int j = begin1; j <= i; j++)
  40.                     cout << j << " ";
  41.                 break;
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement