-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCF116ATram.java
More file actions
34 lines (30 loc) · 965 Bytes
/
CF116ATram.java
File metadata and controls
34 lines (30 loc) · 965 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
27
28
29
30
31
32
33
34
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* See <a href="http://codeforces.com/problemset/problem/116/A">Tram</a>
*
* @author Brian Yeicol Restrepo Tangarife
*/
public class CF116ATram {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int n = Integer.parseInt(in.readLine());
int capacity = 0;
int passengers = 0;
int a, b;
String[] p;
while (n-- > 0) {
p = in.readLine().split("\\s");
a = Integer.parseInt(p[0]);
b = Integer.parseInt(p[1]);
passengers -= a;
passengers += b;
capacity = Math.max(passengers, capacity);
}
out.print(capacity);
out.close();
}
}