-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathFastScanner.java
More file actions
31 lines (31 loc) · 887 Bytes
/
FastScanner.java
File metadata and controls
31 lines (31 loc) · 887 Bytes
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
class FastScanner {
StringTokenizer stringTokenizer =new StringTokenizer("");
BufferedReader bufferedReader =new BufferedReader(new InputStreamReader(System.in));
int[] readArray(int n) {
int[] arr = new int[n];
int i = 0;
while (i<n){
arr[i] = nextInt();
i++;
}
return arr;
}
int nextInt () {
return Integer.parseInt(next());
}
double nextDouble(){
return Double.parseDouble(next());
}
float nextFloat(){
return Float.parseFloat(next());
}
public String next() {
while (!stringTokenizer.hasMoreElements())
try {
stringTokenizer =new StringTokenizer(bufferedReader.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return stringTokenizer.nextToken();
}
}