#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll panu(ll n)
{
if(n == 0)
return 10;
if(n >= 1 && n <= 9)
return n;
int i;
stack<ll>d;
for(i=9;i>=2 && n > 1;i--)
{
while(n%i == 0)
{
d.push(i);
n = n/i;
}
}
if(n != 1)
return -1;
ll k = 0;
while(!d.empty())
{
k = k*10 + d.top();
d.pop();
}
return k;
}
int main()
{
ll n;
cin >> n;
cout << panu(n) << "\n";
return 0;
}
#define ll long long int
using namespace std;
ll panu(ll n)
{
if(n == 0)
return 10;
if(n >= 1 && n <= 9)
return n;
int i;
stack<ll>d;
for(i=9;i>=2 && n > 1;i--)
{
while(n%i == 0)
{
d.push(i);
n = n/i;
}
}
if(n != 1)
return -1;
ll k = 0;
while(!d.empty())
{
k = k*10 + d.top();
d.pop();
}
return k;
}
int main()
{
ll n;
cin >> n;
cout << panu(n) << "\n";
return 0;
}
Comments
Post a Comment