Advertisement
Guest User

Untitled

a guest
Dec 18th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace wiggle
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string[] input = Console.ReadLine().Split(' ');
  14. List<long> result = new List<long>();
  15. for (int i = 0; i < input.Length - 1; i += 2)
  16. {
  17. long num1 = long.Parse(input[i]);
  18. long num2 = long.Parse(input[i + 1]);
  19. for (int j = 0; j <= 62; j += 2)
  20. {
  21. long currentnum1bit = ((num1 >> j) & 1L);
  22. long currentnum2bit = (num2 >> j) & 1L;
  23. if (currentnum1bit == 0)
  24. {
  25. num2 = num2 & ~(1U<< j);
  26. }
  27. if (currentnum1bit == 1)
  28. {
  29. num2 = num2 | (1U << j);
  30. }
  31. if (currentnum2bit == 0)
  32. {
  33. num1 = num1 & ~(1U << j);
  34. }
  35. if (currentnum2bit == 1)
  36. {
  37. num1 = num1 | (1U << j);
  38. }
  39. }
  40. long finalfirstnum = ~num1;
  41. long finalsecondnum = ~num2;
  42. result.Add(finalfirstnum);
  43. result.Add(finalsecondnum);
  44. }
  45. foreach(var num in result)
  46. {
  47. Console.WriteLine(num + " " + Convert.ToString(num,2).PadLeft(64,'0'));
  48. }
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement