Advertisement
Anon2005

Parsare

Nov 17th, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4. const int dim=1<<17;
  5. char next_ch()
  6. {
  7.     static int bp=dim;
  8.     static char buff[dim];
  9.     if(bp==dim)
  10.     {
  11.         fread(buff,1,dim,stdin);
  12.         bp=0;
  13.     }
  14.     return buff[bp++];
  15. }
  16. void get(int &a)
  17. {
  18.     a=0;
  19.     char ch;
  20.     int semn=1;
  21.     do
  22.     {
  23.         if(ch=='-')
  24.             semn=-1;
  25.         ch=next_ch();
  26.     }
  27.     while('9'<ch||ch<'0');
  28.     do
  29.     {
  30.         a=a*10+ch-'0';
  31.         ch=next_ch();
  32.     }
  33.     while('9'>=ch&&ch>='0');
  34.     a*=semn;
  35. }
  36. int main()
  37. {
  38. #ifdef HOME
  39.     freopen("test.in","r",stdin);
  40.     freopen("test.out","w",stdout);
  41. #endif
  42.     int n,i,x;
  43.     get(n);
  44.     /*for(i=1;i<=n;i++)
  45.     {
  46.      get(x);
  47.     }*/
  48.     cout<<n;
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement