1
1
package MinimizingLateness ;
2
2
3
- import java .io .*;
4
- import java .util .*;
3
+
4
+ import java .io .BufferedReader ;
5
+ import java .io .FileReader ;
6
+ import java .io .IOException ;
7
+ import java .util .StringTokenizer ;
5
8
6
9
public class MinimizingLateness {
7
10
@@ -18,23 +21,23 @@ public Schedule(int t, int d) {
18
21
}
19
22
20
23
public static void main (String []args )throws IOException {
21
- // TODO Auto-generated method stub
22
24
StringTokenizer token ;
23
25
24
- String ch ;
25
- BufferedReader in =new BufferedReader (new FileReader ("input.txt" ));
26
- int indexCount ;// size of array index
27
- ch =in .readLine ();
28
- indexCount =Integer .parseInt (ch );// The first line specifies the size of the operation (= the size of the array)
26
+ BufferedReader in =new BufferedReader (new FileReader ("MinimizingLateness/lateness_data.txt" ));
27
+ String ch =in .readLine ();
28
+ if (ch ==null ||ch .isEmpty ()) {
29
+ return ;
30
+ }
31
+ int indexCount =Integer .parseInt (ch );
29
32
System .out .println ("Input Data : " );
30
33
System .out .println (indexCount );// number of operations
31
- Schedule array [] =new Schedule [indexCount ];// Create an array to hold the operation
34
+ Schedule [] array =new Schedule [indexCount ];// Create an array to hold the operation
32
35
int i =0 ;
33
36
while ((ch =in .readLine ()) !=null ) {
34
37
token =new StringTokenizer (ch ," " );
35
38
// Include the time required for the operation to be performed in the array and the time it should be completed.
36
39
array [i ] =new Schedule (Integer .parseInt (token .nextToken ()),Integer .parseInt (token .nextToken ()));
37
- i ++;// 다음 인덱스
40
+ i ++;
38
41
System .out .println (array [i -1 ].t +" " +array [i -1 ].d );
39
42
}
40
43