-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathFasterIO.cpp
40 lines (36 loc) · 841 Bytes
/
FasterIO.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define gc getchar_unlocked
void readInt(int &x){
register char c = gc();
x = 0;
int neg = 0;
for(;((c<48 || c>57) && c != '-');c = gc());
if(c=='-') {neg=1;c=gc();}
for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
if(neg) x=-x;
}
void readVlong (vlong &x){
register char c = gc();
x = 0;
int neg = 0;
for(;((c<48 || c>57) && c != '-');c = gc());
if(c=='-') {neg=1;c=gc();}
for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
if(neg) x=-x;
}
void readChar ( char &x ) {
register char c = gc();
while (c < 33) c = gc();
x = c;
}
void readString(char *str){
register char c = 0;
register int i = 0;
while (c < 33)
c = gc();
while (c != '\n') {
str[i] = c;
c = gc();
i = i + 1;
}
str[i] = '\0';
}