Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<algorithm>
- #include<math.h>
- #include<stdio.h>
- #define SIZE 100
- using namespace std;
- long long n;
- int len = 0, a[SIZE];
- int main()
- {
- freopen("input.txt","r",stdin);
- freopen("output.txt","w",stdout);
- cin >> n;
- if(n == 1)
- {
- cout << "1\n";
- return 0;
- }
- if(n == 0)
- {
- cout << "10\n";
- return 0;
- }
- for(int i = 9; i > 1; i--)
- while(n%i == 0)
- {
- n /= i;
- a[len] = i;
- len++;
- }
- if(n != 1)
- {
- cout << "-1\n";
- return 0;
- }
- while(len > 0)
- {
- len--;
- cout << a[len];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement