Created
January 29, 2014 13:25
-
-
Save Jangwa/8687867 to your computer and use it in GitHub Desktop.
These two are functions that will help you to take input in fast. If you use this to function to take input, execution time decrease dramatically. Without locking the memory inputs are read to buffer so its very fast
This file contains hidden or 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
#define getcx getchar_unlocked | |
inline void inp( int &n )//fast input function | |
{ | |
n=0; | |
int ch=getcx();int sign=1; | |
while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();} | |
while( ch >= '0' && ch <= '9' ) | |
n = (n<<3)+(n<<1) + ch-'0', ch=getcx(); | |
n=n*sign; | |
} | |
inline void inpl(long long int *a) | |
{ | |
register char c=0; | |
while (c<33) c=getchar_unlocked(); | |
*a=0; | |
while (c>33) | |
{ | |
*a=*a*10+c-'0'; | |
c=getchar_unlocked(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment