fork(5) download
  1. #include <stdio.h>
  2. inline void scanint(long long *x)
  3. {
  4. register char c = getchar_unlocked();
  5. *x = 0;
  6. for(; (c<48)||(c>57);c = getchar_unlocked());
  7. for(; (c>47)&&(c<58);c = getchar_unlocked())
  8. *x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);
  9. }
  10.  
  11. inline void printint(long long n)
  12. {
  13. if(n == 0)
  14. {
  15. putchar_unlocked('0');
  16. putchar_unlocked('\n');
  17. }
  18. else if(n == -1)
  19. {
  20. putchar_unlocked('-');
  21. putchar_unlocked('1');
  22. putchar_unlocked('\n');
  23. }
  24. else
  25. {
  26. char buf[11];
  27. buf[10] = '\n';
  28. int i = 9;
  29. while(n)
  30. {
  31. buf[i--] = n % 10 + '0';
  32. n /= 10;
  33. }
  34. while(buf[i] != '\n')
  35. putchar_unlocked(buf[++i]);
  36. }
  37. }
  38. int main(void)
  39. {
  40. long long x;
  41. scanint(&x);
  42. printint(x);
  43. return 0;
  44. }
  45.  
Success #stdin #stdout 0s 2056KB
stdin
10101
stdout
10101