Advertisement
muhata84

Roxettes!!!

Sep 27th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. uint8_t readOneByte()
  4. {
  5. uint8_t ch;
  6. std::cin >> ch;
  7. if(ch >= '0' && ch <= '9')
  8. ch = ch - 48;
  9. else if (ch >= 'A' && ch <= 'F')
  10. ch = ch - 55;
  11. else if (ch >= 'a' && ch <= 'f')
  12. ch = ch - 87;
  13. else if (ch == '.')
  14. ch = 255;
  15.  
  16. return (int)ch;
  17. }
  18.  
  19. int main()
  20. {
  21. std::cin.sync_with_stdio(false);
  22. std::cout.sync_with_stdio(false);
  23.  
  24. uint32_t i = 4294967295;
  25. uint32_t result = 0;
  26.  
  27. while (true){
  28. uint8_t input = readOneByte();
  29. if (input==255) break;
  30. result ^= input<<(--i%5)*4;
  31. }
  32.  
  33. std::cout << std::hex << result;
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement