[백준/Java] 8437 : Julka

SEOP·2024년 6월 21일
0

import java.io.*;
import java.math.BigInteger;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new BufferedReader(new InputStreamReader(System.in)));
        BufferedWriter bw = new BufferedWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        BigInteger total = new BigInteger(br.readLine());
        BigInteger gap = new BigInteger(br.readLine());

        BigInteger firstPerson = total.add(gap).divide(BigInteger.valueOf(2));
        BigInteger secondPerson = total.subtract(gap).divide(BigInteger.valueOf(2));

        bw.write(String.valueOf(firstPerson));
        bw.newLine();
        bw.write(String.valueOf(secondPerson));

        bw.flush();
        bw.close();
    }
}
profile
응애 나 애기 개발자

0개의 댓글