백준 2455 java

magicdrill·2024년 2월 28일

백준 문제풀이

목록 보기
52/673

백준 2455 java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class bj2455 {
    public static void main(String[] args) throws IOException {
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int i;
        int total = 0;
        int out, in;
        int max = 0;
        Scanner scanner = new Scanner(System.in);

        for(i = 0; i < 4; i++)
        {
            out = scanner.nextInt();
            total -= out;
            in = scanner.nextInt();
            total += in;
            if(max < total)
            {
                max = total;
            }
        }
        System.out.println(max);
    }
}

0개의 댓글