Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. ll ans(int n)
  5. {
  6. if(n==0) return 10;
  7. if(n==1) return 1;
  8. ll res=0,temp=1;
  9. for(int i=9;i>=2;i--)
  10. {
  11. while(n%i==0)
  12. {
  13. n/=i;
  14. res+=temp*i;
  15. temp*=10;
  16. }
  17. }
  18. if(n!=1) return -1;
  19. return res;
  20. }
  21. int main()
  22. {
  23. int t,n;
  24. cin>>n;
  25. printf("%d\n",ans(n));
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement