Skip to content

Instantly share code, notes, and snippets.

@jjant
Created June 18, 2018 04:41
Show Gist options
  • Select an option

  • Save jjant/e1e7e68299cc3ec7319e1a3980c7a89a to your computer and use it in GitHub Desktop.

Select an option

Save jjant/e1e7e68299cc3ec7319e1a3980c7a89a to your computer and use it in GitHub Desktop.
--------------
| T1 | T2 | T3 |
|----|----|----|
| r1 | r2 | r3 |
| w1 | w2 | w3 |
--------------
w3 tiene que ir en el ultimo lugar, así que me puedo olvidar de el, y tomar como que solo tengo 5 lugares.
Tengo 5 lugares: _ _ _ _ _
Constraints:
1) r1 < w1, r2 < w2
2) w1 < w2
Pongo w1. No puede ir en el primer lugar (pues r1 < w1), ni en el ultimo (w1 < w2).
Entonces, tengo 3 opciones: _ w1 _ _ _, _ _ w1 _ _, _ _ _ w1 _.
1) Total: 3 formas
_ w1 _ _ _ ->
_ w1 w2 _ _ IMPOSIBLE: No puedo poner r1 < w1, r2 < w2
_ w1 _ w2 _ -> (r1 < w1, r2 < w2)
r1 w1 r2 w2 r3 -> 1 forma
_ w1 _ _ w2 -> (r1 < w1)
r1 w1 _ _ w2 -> 2 formas (r1 w1 r2 r3 w2, r1 w1 r3 r2 w2)
2) Total: 6 formas
_ _ w1 _ _ ->
_ _ w1 w2 r3 -> 2 formas
_ _ w1 _ w2 ->
r1 _ w1 _ w2 ->
r1 r2 w1 r3 w2
r1 r3 w1 r2 w2
_ r1 w1 _ w2 ->
r2 r1 w1 r3 w2
r3 r1 w1 r2 w2
-> 4 formas
3) Total 6 formas
_ _ _ w1 _ -> _ _ _ w1 w2 -> 3! = 6 formas.
Total = 3 + 6 + 6 = 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment