diff --git a/C++/read.cpp b/C++/read.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4a1bfc769dfddb45c620f10b1bb21af3da378a52 --- /dev/null +++ b/C++/read.cpp @@ -0,0 +1,8 @@ +// ... include and using namespace +template < class T > +inline void read ( T & x ) { + char ch = getchar ( ); int f = 1; + for ( ; ch < '0' || ch > '9' ; x = getchar ( ) ) f = ch == '-' ? -1 : 1; + for ( ; ch >= '0' && ch <= '9'; x = getchar ( ) ) x = ( x << 3 ) + ( x << 1 ) + ( ch ^ 48 ); + x *= f; +} \ No newline at end of file