Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <set>
  4. #include <vector>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. long long Arm_Strong(int x)
  10. {
  11. int Sum = 0;
  12. int temp =x;
  13. int n = 0;
  14. while (temp > 0)
  15. {
  16. temp /= 10;
  17. n++;
  18. }
  19. temp = x;
  20. while (temp > 0)
  21. {
  22. int k = temp % 10;
  23. for (int j = 1; j < n; j++)
  24. k *= temp % 10;
  25. temp /= 10;
  26. Sum += k;
  27. }
  28. if (Sum == x)
  29. return true;
  30. return false;
  31. }
  32. signed main()
  33. {
  34. int x;
  35. cin >> x;
  36. cout << Arm_Strong(x);
  37. cin >> x;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement