fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. int l = 0;
  8. for(int i = 1; n > 0; i++)
  9. {
  10. int sum = 0, mult = 1;
  11. int c = i;
  12. while(c > 0)
  13. {
  14. sum += c % 10;
  15. mult *= (c % 10);
  16. c /= 10;
  17. }
  18. if(sum == mult) n--;
  19. l = i;
  20. }
  21. cout << l;
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5288KB
stdin
5
stdout
5