Skip to content

Commit f6a9c00

Browse files
committed
refactor: simplify Main structure and add assertion in p2190B1
1 parent b57909f commit f6a9c00

File tree

2 files changed

+10
-32
lines changed
  • src/main/java/com/lzw/solutions

2 files changed

+10
-32
lines changed

src/main/java/com/lzw/solutions/codeforces/p2190B1/Main.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ private void solve() throws IOException {
3131
while (t-- > 0) {
3232
int n = Integer.parseInt(in.readLine());
3333
String s = in.readLine();
34+
assert (s.length() == n);
3435
out.println(s);
3536
}
3637
}
Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,17 @@
11
package com.lzw.solutions.sample.pjava_sample_buf;
22

3-
import java.io.BufferedReader;
4-
import java.io.IOException;
5-
import java.io.InputStreamReader;
6-
import java.io.PrintWriter;
3+
import java.io.*;
74

85
public class Main {
6+
private static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
7+
private static final PrintWriter out = new PrintWriter(System.out, true);
98

10-
BufferedReader in;
11-
PrintWriter out;
12-
13-
Main() {
14-
in = new BufferedReader(new InputStreamReader(System.in));
15-
out = new PrintWriter(System.out);
16-
}
17-
18-
int readInt() throws IOException {
19-
return Integer.parseInt(in.readLine());
9+
private static void solve() throws IOException {
10+
// your code here
2011
}
2112

22-
void solve() throws IOException {}
23-
24-
void close() throws IOException {
25-
if (in != null) {
26-
in.close();
27-
}
28-
if (out != null) {
29-
out.flush();
30-
out.close();
31-
}
32-
}
33-
34-
public static void main(String[] args) throws Exception {
35-
36-
Main main = new Main();
37-
main.solve();
38-
main.close();
13+
public static void main(String[] args) throws IOException {
14+
solve();
15+
out.close();
3916
}
40-
}
17+
}

0 commit comments

Comments
 (0)