-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathRepair.java
More file actions
26 lines (24 loc) · 1011 Bytes
/
Copy pathRepair.java
File metadata and controls
26 lines (24 loc) · 1011 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
package repair;
import java.io.*;
import java.util.*;
public class Repair {
public static void main(String[] args) throws IOException {
ArrayList<Integer> length = new ArrayList<>();
int result;
String str;
FileReader file = new FileReader("input.txt"); // Считывание данных из файла
Scanner sc = new Scanner(file);
str = sc.nextLine();
StringTokenizer st = new StringTokenizer(str, " ");
while (st.hasMoreTokens()){
length.add(Integer.valueOf(st.nextToken())); // Записать все элементы в коллекцию
}
result = (2 * (length.get(0) * length.get(2) + length.get(1) * length.get(2))) / 16;
if((2 * (length.get(0) * length.get(2) + length.get(1) * length.get(2))) % 16 != 0){
result = result + 1;
}
FileWriter fileOut = new FileWriter("output.txt");
fileOut.write(String.valueOf(result));
fileOut.close();
}
}