Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- using namespace std;
- int main()
- {
- long long n, ans = 0, q = 0;
- cin >> n;
- if (n<2)
- {
- cout << n << endl;
- return 0;
- }
- for (int i = 9; i >= 2; i--)
- {
- while (n%i == 0)
- {
- ans = ans * 10 + i;
- n = n / i;
- //cout << ans << endl;
- }
- }
- if (n != 1)
- cout << -1 << endl;
- else
- {
- while (ans > 0)
- {
- q = ans % 10 + q * 10;
- ans = (ans - ans % 10) / 10;
- }
- cout << q << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement