ellapt

WeAllLoveBits

Dec 14th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System;
  2.  
  3. class WeAllLoveBits
  4. {
  5. static void Main()
  6. {
  7. int nNum = int.Parse(Console.ReadLine());
  8.  
  9. for (int i = 1; i <= nNum; i++)
  10. {
  11. int numP = int.Parse(Console.ReadLine());
  12.  
  13. int numPmagic = 0;
  14. while (numP > 0)
  15. {
  16. numPmagic <<= 1;
  17. if ((numP & 1) == 1)
  18. {
  19. numPmagic|= 1;
  20. }
  21. numP >>= 1;
  22. }
  23.  
  24. Console.WriteLine(numPmagic);
  25. }
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment