Created
April 10, 2015 00:35
-
-
Save dobrokot/0de3f031951988484f71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int f(int x) { | |
if (x == 0) | |
return 0; | |
int sign = x < 0 ? -1 : 1; | |
return ((x&1) ? -x : +x) - sign; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment