Advertisement
saske_7

fastscan.cpp

Nov 15th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int fastscan(){
  5. int ret, num = 0 , negetive = -1    ;
  6. char ch ;
  7.     //getchar();
  8.     while(ch = getchar()){
  9.     if(ch != ' ' || ch ==  '\n' ) break ;
  10.  
  11.     }
  12.     if(ch == '-' ) negetive = 1 ;
  13.     else    num = 10* num + ch -'0';
  14. //  if(ch ==  'x') return -1 ;
  15.     while(1){
  16.         ch =  getchar();
  17.         if(ch ==  '\n' || ch == ' ' ) break ;
  18.         num = 10* num + ch -'0';
  19.  
  20.     }
  21.     if(negetive ==  1) num *= -1 ;
  22.     return num  ;
  23. }
  24.  
  25. int main(){
  26. int k ;
  27. while(1){
  28.    k = fastscan();
  29.   cout << k <<endl ;
  30.  
  31.  
  32. }
  33.  
  34.  
  35. return 0 ;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement