Header File:-#include<cstdio> (For c++)
#include<wchar.h> (For C)
Input for Character Variables :-
Use getchar_unlocked() for fastest input.
Eg.
char ch;
ch=getchar_unlocked();
Input for Integer Variables :-
Define a function that will take the input as:-
#define get getchar_unlocked
inline int fastinput( )
{
int n = 0 , s = 1 ; char p = get( ) ;
if( p == '-' ) s=-1;
while( ( p < '0' || p > '9' ) && p != EOF && p != '-' )
p = get( ) ;
if( p == '-' )
s = -1 , p = get( ) ;
while( p >= '0' && p <= '9' )
{
n = ( n << 3 ) + ( n << 1 ) + ( p - '0' ) ;
p = get( ) ;
}
return n * s ;
}
No comments:
Post a Comment