algorithm/백준
백준 2455 Java 자바
umilove98
2021. 8. 30. 20:50
반응형
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
27
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Q2455 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int people = 0;
int max = 0;
for(int i = 0; i < 4; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int out = Integer.parseInt(st.nextToken());
int in = Integer.parseInt(st.nextToken());
people -= out;
people += in;
if(people > max) {
max = people;
}
}
System.out.println(max);
}
}
|
cs |
반응형