Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. X EXPECTED RESULT YOUR RESULT
  2. Success 29 0 0
  3. Success 4 1 1
  4. Success -2 -2 -2
  5. Success 3 1 1
  6. Success -4 -1 -1
  7. Success 2 2 2
  8. Success -95 0 0
  9. Success -1 -4 -4
  10. Success 1 4 4
  11.  
  12. using System;
  13. public class Program {
  14. public static int Puzzle(int x) {
  15. if (x==1) return 4;
  16. if (x==-1) return -4;
  17. if (x<-4 || x>4) return 0;
  18. if (x<-2) return -1;
  19. if (x<0) return x;
  20. if (x>3) return 1;
  21. return 4-x;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement