Masovski

Cartesian Coords JS

Apr 6th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Solve(params) {
  2.   // Read input data
  3.   var X = parseInt(params[0]);
  4.   var Y = parseInt(params[1]);
  5.  
  6.   // Solve the problem
  7.   if (X === 0 && Y === 0)
  8.   {
  9.     return 0;
  10.   }
  11.   else if (X === 0)
  12.   {
  13.     return 5;
  14.   }
  15.   else if (Y === 0)
  16.   {
  17.     return 6;
  18.   }
  19.   else if (X > 0 && Y > 0)
  20.   {
  21.     return 1;
  22.   }
  23.   else if (X < 0 && Y > 0)
  24.   {
  25.     return 2;
  26.   }
  27.   else if (X < 0 && Y < 0)
  28.   {
  29.     return 3;
  30.   }
  31.   else
  32.   {
  33.     return 4;
  34.   }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment