Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <assert.h>
- #include <bits/stdc++.h>
- #include <atcoder/modint>
- using namespace std;
- template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
- using ll = long long;
- using pii = pair<int, int>;
- using pll = pair<ll, ll>;
- using vl = vector<ll>;
- using vi = vector<int>;
- using mint = atcoder::modint998244353;
- map<ll, mint> ss;
- void gets(ll target)
- {
- if (ss.count(target))
- return;
- if (target == 1)
- return;
- ss[target] = 0;
- for (int i = 2; i <= 6; ++i)
- if (target % i == 0)
- gets(target / i);
- }
- int main(int argc, char **argv)
- {
- ll n;
- cin >> n;
- ll nn = n;
- while (nn % 2 == 0)
- nn = nn / 2;
- while (nn % 3 == 0)
- nn = nn / 3;
- while (nn % 5 == 0)
- nn = nn / 5;
- if (nn != 1) {
- cout << 0 << endl;
- return 0;
- }
- gets(n);
- ss[1] = 1;
- for (auto p : ss)
- for (int i = 2; i <= 6; ++i) {
- ll ns = p.first * i;
- mint prob = p.second;
- if (ss.count(ns))
- ss[ns] += prob / 5;
- }
- cout << ss[n].val() << endl;
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement