Exercise C
Exercise C
Jinkyu Lee
Dept. of Computer Science and Engineering,
Sungkyunkwan University (SKKU)
◼ Why 5 points?
◼ I want all students to solve this exercise to participate in-class discussion for
the exercise.
◼ Input: the time for each person to move from A to B (integer numbers).
Jinkyu Lee
Dept. of Computer Science and Engineering 3
Exercise C
2 people
1 person
1 2 5 10
1 2 5 10
Jinkyu Lee
Dept. of Computer Science and Engineering 4
Exercise C
◼ Example
◼ Input
1 2 5 10
◼ Output
// [1 2 5 10 / ]
12 // Two people move from A to B during max(1,2) time units. [5 10 / 1 2]
1 // A person moves from B to A during 1 time unit. [ 1 5 10 / 2]
5 10 // Two people move from A to B during max(5,10) time units. [1 / 2 5 10]
2 // A person moves from B to A during 2 time units. [1 2 / 5 10]
12 // Two people move from A to B during max(1,2) time units. [ / 1 2 5 10]
Jinkyu Lee
Dept. of Computer Science and Engineering 5