Advertisement
LEGEND2004

9542

Mar 11th, 2024
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #pragma GCC optimize("O3")
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define io ios_base::sync_with_stdio(0); cin.tie(0)
  7. #define pb push_back
  8. #define F first
  9. #define S second
  10. #define endl '\n'
  11. const int N = 1e6 + 5;
  12.  
  13.  
  14. signed main()
  15. {
  16.     io;
  17.  
  18.     int n;
  19.     cin >> n;
  20.     vector<int> v;
  21.     for(int i = 2; i <= 9; i++){
  22.         while(n % i == 0){
  23.             v.pb(i);
  24.             n /= i;
  25.         }
  26.     }
  27.     if(n != 1){
  28.         cout << "-1";
  29.         return 0;
  30.     }
  31.     reverse(v.begin() , v.end());
  32.     for(int i : v)
  33.         cout << i;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement