Java
- 1 ответ
- 0 вопросов
0
Вклад в тег
public class Main {
public static void main(String[] args) throws Exception {
String inputFile = "", outputFile = "";
String res = Files.lines(Paths.get(inputFile))
.map(line -> new int[]{
Integer.parseInt(line.split(" ")[0]),
Integer.parseInt(line.split(" ")[1])}
).reduce((identity, accumulator) -> new int[]{
identity[0] + accumulator[0],
identity[1] + accumulator[1]
}).map(resArr -> {
if (resArr[0] > resArr[1]) return "1";
if (resArr[0] < resArr[1]) return "2";
return "DRAW";
}).get();
PrintWriter printWriter = new PrintWriter(outputFile);
printWriter.write(res);
printWriter.close();
}
}