fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. uint32_t solve( uint32_t x )
  5. {
  6. x ^= x >> 1;
  7. x ^= x >> 2;
  8. x ^= x >> 4;
  9. // x ^= x >> 8;
  10. // x ^= x >> 16;
  11. return x & 1;
  12. }
  13.  
  14. int main( void )
  15. {
  16. for (int i = 0; i < 100; ++i) {
  17. if (solve(i)) printf( "%d ", i );
  18. }
  19. printf( "\n" );
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
1 2 4 7 8 11 13 14 16 19 21 22 25 26 28 31 32 35 37 38 41 42 44 47 49 50 52 55 56 59 61 62 64 67 69 70 73 74 76 79 81 82 84 87 88 91 93 94 97 98