Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <vector>
- #include <cmath>
- #include <string>
- #include <algorithm>
- #include <string>
- #include <string.h>
- #define F first
- #define S second
- using namespace std;
- vector <long long> p, b;
- int main()
- {
- ios_base::sync_with_stdio(0);
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- long long n;
- cin >> n;
- long long d = 2;
- while (d * d <= n)
- {
- if (n % d == 0)
- {
- p.push_back(d);
- int z = 0;
- while (n % d == 0)
- {
- z++;
- n /= d;
- }
- b.push_back(z);
- }
- if (d == 2)
- d = 3;
- else
- d += 2;
- }
- if (n >= 1)
- {
- p.push_back(n);
- b.push_back(1);
- }
- //cout << p.size() << " " << b.size() << endl;
- //for (int i = 0; i < p.size(); i++)
- // cout << p[i] << " " << b[i] << endl;
- int k = p.size() - 1;
- //cout << b[k] << endl;
- if (k > 0)
- {
- for (int i = 0; i < k; i++)
- for (int j = 0; j < b[i]; j++)
- cout << p[i] << "*";
- for (int i = 0; i < b[k] - 1; i++)
- cout << p[k] << "*";
- cout << p[k];
- }
- else
- {
- for (int i = 0; i < b[0] - 1; i++)
- cout << p[0] << "*";
- cout << p[0];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement