fork(4) download
  1. #include<bits/stdc++.h>
  2.  
  3. #define pi acos(-1)
  4. #define all(x) (x).begin(),(x).end()
  5. #define fill(x,y) memset(x, y, sizeof(x))
  6. #define trace(x) cout << #x << " = " << x << endl
  7. #define bug cout << "Bug check" << endl
  8. #define endl '\n'
  9.  
  10. using namespace std;
  11.  
  12. int main(){
  13. //freopen("in.txt","r", stdin);
  14. //freopen("out.txt","w", stdout);
  15.  
  16. //ios::sync_with_stdio(0);
  17. //cin.tie(0);
  18. long long n; cin >> n;
  19.  
  20. vector <int> v;
  21.  
  22. if(n==1){
  23. cout << "1" << endl;
  24. return 0;
  25. }
  26. else if(n==0){
  27. cout << "10" << endl;
  28. return 0;
  29. }
  30. for(int i=9;i>=2;i--){
  31. while(n%i==0){
  32. n=n/i;
  33. v.push_back(i);
  34. }
  35. }
  36. if(n==1){
  37. for(int i = v.size()-1; i>=0 ; i--){
  38. cout << v[i];
  39. }
  40. cout << endl;
  41. }
  42. else{
  43. cout << "-1" << endl;
  44. }
  45. return 0;
  46. }
Success #stdin #stdout 0s 4468KB
stdin
10
stdout
25