Skip to content

Instantly share code, notes, and snippets.

@Alafazam
Last active August 29, 2015 14:25
Show Gist options
  • Save Alafazam/5827878a62d2a70ea29a to your computer and use it in GitHub Desktop.
Save Alafazam/5827878a62d2a70ea29a to your computer and use it in GitHub Desktop.
/*
grab the whole line
char a[100];
cin.getline(a,100);
scanf("%[^\n]",a);
gets(a);
*/
inline void fastRead_int(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();
}
}
inline void fastRead_string(char *str)
{
register char c=0;
register int i = 0;
while (c < 33)
c = getchar_unlocked();
while (c > 65)
{
str[i] = c;
c = getchar_unlocked();
i = i + 1;
}
str[i] = '\0';
}
int main()
{
int n;
char s[16];
fastRead_int(&n);
fastRead_string(s);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment