fork(1) download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <set>
  4. #include <stdint.h>
  5.  
  6. int main() {
  7. const auto n_hashbits = 5;
  8. const auto i_max = 1ull << n_hashbits;
  9. uint64_t min_magic = -1;
  10.  
  11. for (uint64_t i_b2 = 1; i_b2 < i_max; ++i_b2) {
  12.  
  13. for (uint64_t i_d2 = 1; i_d2 < i_max; ++i_d2) {
  14. if (i_d2 == i_b2) continue;
  15.  
  16. for (uint64_t i_e3 = 1; i_e3 < i_max; ++i_e3) {
  17. if (i_e3 == i_d2 || i_e3 == i_b2) continue;
  18.  
  19. for (uint64_t i_f4 = 1; i_f4 < i_max; ++i_f4) {
  20. if (i_f4 == i_e3 || i_f4 == i_d2 || i_f4 == i_b2) continue;
  21.  
  22. for (uint64_t i_g5 = 1; i_g5 < i_max; ++i_g5) {
  23. if (i_g5 == i_f4 || i_g5 == i_e3 || i_g5 == i_d2 || i_g5 == i_b2) continue;
  24.  
  25. uint64_t magic = i_b2 << 50;
  26. magic |= i_d2 << 48;
  27. magic |= i_e3 << 39;
  28. magic |= i_f4 << 30;
  29. magic |= i_g5 << 21;
  30. min_magic = std::min(min_magic, magic);
  31. }
  32. }
  33. }
  34. }
  35. }
  36.  
  37. std::cout << "Min magic: " << std::hex << min_magic << std::endl;
  38. }
Success #stdin #stdout 0.05s 15232KB
stdin
Standard input is empty
stdout
Min magic: 40100c0a00000