fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string ilo(int n)
  6. {
  7. int liczba[10] = {};
  8. for (int i = 9; i >= 2; i--)
  9. {
  10. while (n % i == 0)
  11. {
  12. liczba[i]++;
  13. n /= i;
  14. }
  15. }
  16. if (n > 1)
  17. {
  18. return "NIE DA SIE!";
  19. }
  20. string ret;
  21. for (int i = 2; i <= 9; i++)
  22. {
  23. while (liczba[i]--)
  24. {
  25. ret += i + '0';
  26. }
  27. }
  28. return ret.empty() ? "0" : ret;
  29. }
  30.  
  31. int main()
  32. {
  33. int x;
  34. cin >> x;
  35. cout << ilo(x) << endl;
  36. return 0;
  37. }
Success #stdin #stdout 0s 3476KB
stdin
10
stdout
25