Skip to content

Instantly share code, notes, and snippets.

@delta4d
Created November 29, 2013 13:08
Show Gist options
  • Save delta4d/7705490 to your computer and use it in GitHub Desktop.
Save delta4d/7705490 to your computer and use it in GitHub Desktop.
// unsigned
template <class T> inline T fastin() {
register char c = 0;
register T a = 0;
while (c < '0' || c > '9') c = getchar();
while ('0' <= c && c <= '9') a = a * 10 + c - '0', c = getchar();
return a;
}
// signed
template <class T> inline T fastin() {
register char c = 0;
register T a = 0;
T sgn = 1;
while (c < '0' || c > '9') {
c = getchar();
if (c == '-') sgn = -1;
}
while ('0' <= c && c <= '9') a = a * 10 + c - '0', c = getchar();
return sgn * a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment