Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define int long long
- using namespace std;
- int count1(int N)
- {
- int res = 0;
- while (N > 0)
- {
- res += (N / 5);
- N /= 5;
- }
- return res;
- }
- main()
- {
- int m, begin1, p = 0;
- cin >> m;
- for (int i = 1; i <= 1000000; i++)
- {
- if (count1(i) == m)
- {
- begin1 = i;
- ++p;
- break;
- }
- else if (count1(i) > m)
- break;
- }
- if (p == 0)
- cout << 0;
- else
- {
- for (int i = begin1 + 6; i >= begin1 + 1; i--)
- {
- if (count1(i) == m)
- {
- cout << i - begin1 + 1 << endl;
- for (int j = begin1; j <= i; j++)
- cout << j << " ";
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement