Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define task "DIVISORS"
- #include <iostream>
- #include <cstdio>
- using namespace std;
- using ll = long long;
- using ld = long double;
- constexpr int N = 8 + 5;
- int n;
- int p[] = {2, 3, 5, 7, 11, 13, 17, 19}; // Danh sách số nguyên tố
- int t[N]; // Số mũ của các số nguyên tố trong danh sách trên
- void Read()
- {
- cin >> n;
- }
- void Solve()
- {
- // Phân tích thừa số nguyên tố
- for (int i = 0; i < 8; ++i)
- for (int j = 2; j <= n; ++j)
- {
- int v = j;
- while (v % p[i] == 0)
- {
- v /= p[i];
- ++t[i];
- }
- }
- ll ans(1);
- // Tính số ước của N!
- for (int i = 0; i < 8; ++i)
- ans = ans * (t[i] + 1);
- cout << ans - 1;
- }
- int32_t main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- if (fopen(task ".INP", "r"))
- {
- freopen(task ".INP", "r", stdin);
- freopen(task ".OUT", "w", stdout);
- }
- Read();
- Solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement