fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n = 602071;
  6.  
  7. int result = 0;
  8.  
  9. int power_idx = 1;
  10.  
  11. for (int i = 0; i <= 9; ++i) {
  12. int n1 = n;
  13. while(n1 != 0) {
  14. int last_digit = n1 % 10;
  15. if (last_digit == i) {
  16. result = result + power_idx * i;
  17. power_idx = power_idx * 10;
  18. }
  19. n1 = n1 / 10;
  20. }
  21.  
  22. }
  23.  
  24. printf("%d", result);
  25.  
  26. return result;
  27. }
Runtime error #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
762100