Coderforces Tram
2017-06-13 10:37
288 查看
http://codeforces.com/problemset/problem/116/A
import java.util.Scanner;
public class Tram {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int max = 0;
int temp = 0;
for(int i = 0; i <n; i++) {
int a = scanner.nextInt();
int b= scanner.nextInt();
//车内容量
temp += b - a ;
if(max < temp) max = temp;
}
System.out.println(max);
}
}
import java.util.Scanner;
public class Tram {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int max = 0;
int temp = 0;
for(int i = 0; i <n; i++) {
int a = scanner.nextInt();
int b= scanner.nextInt();
//车内容量
temp += b - a ;
if(max < temp) max = temp;
}
System.out.println(max);
}
}
相关文章推荐
- Coderforces 242E XOR on Segment
- CodeCoder vs TopForces Gym - 101142C
- coderforces 706B Interesting drink(二分)
- 文章标题 coderforces 148D : Bag of mice (概率DP)
- Coderforces Twins
- Coderforces Queue at the School
- coderforces 508A 易错
- Coderforces Lucky Division
- Codeforces Coder-Strike 2014 (Div. 2) C: Online Meeting 来得最早走得最晚的leader
- GYM 101142 C.CodeCoder vs TopForces(dfs)
- 文章标题 Coderforces 382C :Arithmetic Progression(代码能力+细心分类)
- coderforce Educational Codeforces Round 6 E.New Year Tree
- Coderforces 508B 简单贪心
- Beaver's Calculator coderforces 70A1 蓝桥杯
- coderforces Way Too Long Words
- Coderforces Presents
- 文章标题 coderforces 609E : Minimum spanning tree for each edge (MST+LCA)
- Codeforces Round #225 (Div. 2) A.Coder
- coderforces 690D1 - The Wall (easy)(DFS)
- 文章标题 CoderForces 1B : Spreadsheets(模拟)