Skip to content

Instantly share code, notes, and snippets.

@sungkmi
Created April 19, 2024 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sungkmi/0ff3dd5d87ba503ddb36c4bd92711901 to your computer and use it in GitHub Desktop.
Save sungkmi/0ff3dd5d87ba503ddb36c4bd92711901 to your computer and use it in GitHub Desktop.
  • 복귀자 1명일때 시간: (t.2 + t.1) + (t.3 + t.1) + t.4 = 2t.1 + t.2 + t.3 + t.4
  • 복귀자 2명일때 시간: (t.2 + t.1) + (t.4 + t.2) + t.2 = t.1 + 3t.2 + t.4

(최소 시간) = (2t.1 + t.2 + t.3 + t.4) $\downarrow$ (t.1 + 3t.2 + t.4) = (t.1 + t.2 + t.4) + { (t.1 + t.3) $\downarrow$ 2t.2 }

t는 각각 1, 2, 5, 10 이므로 대입하면 17분이다.

1번 사람이 더 빠른 경우는 1번 사람 3번 사람의 건너는 시간의 합이 2번 사람 건너는 시간의 두 배보다 작은 경우이므로 예를 들어 1, 4, 5, 10 의 경우엔 1번 사람이 한 명씩 데리고 건너는 것이 더 빠르다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment