-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest3.java
More file actions
43 lines (36 loc) · 1.06 KB
/
Test3.java
File metadata and controls
43 lines (36 loc) · 1.06 KB
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
35
36
37
38
39
40
41
42
43
package org.line;
import java.util.ArrayList;
import java.util.Scanner;
public class Test3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int[][] persons = new int[num][2];
for(int i=0; i<num; i++) {
persons[i][0] = Integer.parseInt(sc.next());
persons[i][1] = Integer.parseInt(sc.next());
}
int time = 0;
int[] timeList = new int[150];
int isOver=0;
while (isOver!=num) {
for(int i=0; i<num; i++) {
if(persons[i][0]<= time && persons[i][1]>=time) {
if(persons[i][0] == persons[i][1]) {
isOver++;
}
else {
persons[i][0]++;
timeList[time]++;
}
}
}
time++;
}
int max = 0;
for(int i=0; i<timeList.length;i++) {
if(max < timeList[i])
max = timeList[i];
}
}
}