fork(2) download
  1. #include <cmath>
  2. #include <iostream>
  3.  
  4. #define DIVISOR 11U
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. const auto input = 1215598U;
  10. auto count = 0U;
  11.  
  12. for(auto MSD = input == 0U ? 1U : static_cast<unsigned>(pow(10.0, floor(log10(input)) + 1.0)); MSD > 1U; MSD /= 10) {
  13. for(auto LSD = MSD / 10U; LSD > 0U; LSD /= 10U) {
  14. const auto i = input % MSD / LSD;
  15.  
  16. if(i % DIVISOR == 0U) {
  17. ++count;
  18. cout << i << endl;
  19. }
  20. }
  21. }
  22. cout << count << endl;
  23. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
121
12155
15598
55
4