Skip to content

Commit a7c215d

Browse files
authored
Update Queries.java
1 parent 1f34064 commit a7c215d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Queries.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,45 @@ private static int getPreviousPowerOfTwo(int size)
5353
}
5454

5555
}
56+
57+
class MyScanner {
58+
BufferedReader br;
59+
StringTokenizer st;
60+
61+
public MyScanner() {
62+
br = new BufferedReader(new InputStreamReader(System.in));
63+
}
64+
65+
String next() {
66+
while (st == null || !st.hasMoreElements()) {
67+
try {
68+
st = new StringTokenizer(br.readLine());
69+
} catch (IOException e) {
70+
e.printStackTrace();
71+
}
72+
}
73+
return st.nextToken();
74+
}
75+
76+
int nextInt() {
77+
return Integer.parseInt(next());
78+
}
79+
80+
long nextLong() {
81+
return Long.parseLong(next());
82+
}
83+
84+
double nextDouble() {
85+
return Double.parseDouble(next());
86+
}
87+
88+
String nextLine() {
89+
String str = "";
90+
try {
91+
str = br.readLine();
92+
} catch (IOException e) {
93+
e.printStackTrace();
94+
}
95+
return str;
96+
}
97+
}

0 commit comments

Comments
 (0)