Created
September 8, 2020 17:30
-
-
Save PedroRacchetti/8f754b6b48ac89aec69d120521cebcae 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
inline void print(int n){ | |
if (n == 0) | |
{ | |
putchar_unlocked('0'); | |
putchar_unlocked('\n'); | |
} | |
else if (n == -1) | |
{ | |
putchar_unlocked('-'); | |
putchar_unlocked('1'); | |
putchar_unlocked('\n'); | |
} | |
else | |
{ | |
char buf[11]; | |
buf[10] = ' '; | |
int i = 9; | |
while (n) | |
{ | |
buf[i--] = n % 10 + '0'; | |
n /= 10; | |
} | |
while (buf[i] != ' ') | |
putchar_unlocked(buf[++i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment