0% found this document useful (0 votes)
31 views5 pages

Exercise C

This document describes an exercise about optimizing the time for N people to travel between locations A and B using bicycles. It provides that up to two people can ride each bicycle, and the speed depends on the slower rider. Students are given the individual travel times and must output the optimal grouping of people to minimize total travel time. An example with N=5 people and their times is provided, with the optimal solution taking a total of 17 time units. The exercise is worth 5 points and students must submit a report by the given deadline.

Uploaded by

Choi Jiwon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views5 pages

Exercise C

This document describes an exercise about optimizing the time for N people to travel between locations A and B using bicycles. It provides that up to two people can ride each bicycle, and the speed depends on the slower rider. Students are given the individual travel times and must output the optimal grouping of people to minimize total travel time. An example with N=5 people and their times is provided, with the optimal solution taking a total of 17 time units. The exercise is worth 5 points and students must submit a report by the given deadline.

Uploaded by

Choi Jiwon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Problem Solving Techniques 문제해결

Jinkyu Lee
Dept. of Computer Science and Engineering,
Sungkyunkwan University (SKKU)

SWE2026 Problem Solving Techniques


Exercise C
◼ 5 points
◼ The exercise is not evaluated in detail but evaluated as Pass/Fail.
◼ (Note that each homework will be about 100 points.)

◼ Why 5 points?
◼ I want all students to solve this exercise to participate in-class discussion for
the exercise.

◼ Report submission (no code submission)


◼ Due date: 3/29 23:59 (no late submission accepted)
◼ Submission site: https://icampus.skku.edu/
◼ Submission format: [Template] Report for exercise/homework
◼ File name: yourid_EX_C.pdf
◼ Example: 2000123456_EX_C.pdf
Jinkyu Lee
Dept. of Computer Science and Engineering 2
Exercise C
◼ Bicycle
◼ N people are now at A with a bicycle, and they want to move to B
(1<=N<=1000).
◼ A person or two people should ride a bicycle to move between A and B. (Up
to two people can ride a single bicycle).
◼ Each person has a different speed for riding a bicycle.
◼ If two people ride a bicycle, the speed of the bicycle depends on the speed
of the slower person.
◼ The goal is to minimize the time for the N people to move to B.

◼ Input: the time for each person to move from A to B (integer numbers).

◼ Output: a series of lines, each containing either one or two numbers,


indicating which person/people form the next group to move. Each
person is indicated by the time to move between A and B.

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]

◼ In this example, the time for the 5 people to move to B is 2+1+10+2+2=17

Jinkyu Lee
Dept. of Computer Science and Engineering 5

You might also like