fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int n;
  8. cin>>n;
  9.  
  10. int armNum = 0;
  11. int size = 0;
  12.  
  13. int original = n;
  14.  
  15. while(original != 0){
  16. size++;
  17. original = original/10;
  18. }
  19.  
  20. while(size > 0){
  21. int temp = n%10;
  22. armNum = armNum + temp*temp*temp;
  23. n /= 10;
  24. size--;
  25. }
  26.  
  27. cout<<armNum<<endl;
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5320KB
stdin
123
stdout
36