Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. inline i64 nextInt()
  2. {
  3.     i64 s = 1, x = 0, c = getc(stdin);
  4.     while (c <= 32)
  5.         c = getc(stdin);
  6.     if (c == '-')
  7.         s = -1, c = getc(stdin);
  8.     while ('0' <= c && c <= '9')
  9.         x = x * 10 + c - '0', c = getc(stdin);
  10.     return x * s;
  11. }
  12.  
  13. inline void printInt(i64 x)
  14. {
  15.     if (x < 0)
  16.         putc('-', stdout), x = -x;
  17.     char s[20];
  18.     i64 n = 0;
  19.     while (x || !n)
  20.         s[n++] = '0' + x % 10, x /= 10;
  21.     while (n--)
  22.         putc(s[n], stdout);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement