Skip to content

Commit 8113091

Browse files
committed
fix(codeforces/2108F): Correct Main.java issues
1 parent f42892a commit 8113091

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

codeforces/2108F/src/Main.java

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import java.io.BufferedReader;
2+
import java.io.FileInputStream;
23
import java.io.IOException;
34
import java.io.InputStreamReader;
5+
import java.io.PrintStream;
46
import java.io.PrintWriter;
57

68
public class Main {
@@ -13,22 +15,37 @@ public class Main {
1315
out = new PrintWriter(System.out);
1416
}
1517

16-
public static void main(String[] args) throws IOException {
17-
Main m = new Main();
18-
m.solve();
19-
m.close();
18+
void solve() throws IOException {
2019
}
2120

22-
void close() {
23-
out.flush();
24-
out.close();
21+
void close() throws IOException {
22+
if (in != null) {
23+
in.close();
24+
}
25+
if (out != null) {
26+
out.flush();
27+
out.close();
28+
}
2529
}
2630

27-
void solve() throws IOException {
28-
int t = Integer.parseInt(in.readLine());
29-
while (t > 0) {
30-
t--;
31-
int n = Integer.parseInt(in.readLine());
31+
public static void main(String[] args) throws Exception {
32+
FileInputStream inStream = null;
33+
PrintStream outStream = null;
34+
boolean isLocal = System.getProperty("os.name").equals("Mac OS X");
35+
if (isLocal) {
36+
inStream = new FileInputStream("1.in");
37+
// outStream = new PrintStream("1.out");
38+
System.setIn(inStream);
39+
// System.setOut(outStream);
40+
}
41+
42+
Main main = new Main();
43+
main.solve();
44+
main.close();
45+
46+
if (isLocal) {
47+
inStream.close();
48+
// outStream.close();
3249
}
3350
}
34-
}
51+
}

0 commit comments

Comments
 (0)