fork(4) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. bool fine = true;
  8. for (int i = -5 ; i != 6 ; i++) {
  9. for (int j = -5 ; j != 6 ; j++) {
  10. ulong c = Combine(i, j);
  11. int iBack, jBack;
  12. Decombine(c, out iBack, out jBack);
  13. if (i != iBack || j != jBack) {
  14. fine = false;
  15. Console.WriteLine("{0}/{1} {2}/{3}", i, iBack, j, jBack);
  16. }
  17. }
  18. }
  19. if (fine) {
  20. Console.WriteLine("OK");
  21. }
  22. }
  23. private static ulong Combine(int a, int b) {
  24. uint ua = (uint)a;
  25. ulong ub = (uint)b;
  26. return ub <<32 | ua;
  27. }
  28. private static void Decombine(ulong c, out int a, out int b) {
  29. a = (int)(c & 0xFFFFFFFFUL);
  30. b = (int)(c >> 32);
  31. }
  32. }
Success #stdin #stdout 0.02s 14564KB
stdin
Standard input is empty
stdout
OK