Sol

Sol

sábado, 26 de marzo de 2011

¿Y qué paso en ACM?

Maldición! Acabamos 2 de 3 ejercicios mi compañero y yo, y quizás hubieran sido 3 pero nuestro nivel de ingles-Totomeca nos traiciono, no entiamos que era lo que pedia!! Que demonios?¡!?¡!?¡!¡! Jajaja nimodo compartir 2do lugar con otro equipo no esta tan mal -.-...

El ejercicio que nos venció al parecer ( segun mis compañeros que lo hicieron a medias) era sencillo, sin embargo habia una parte que nos confundia a mi compañero y a mi, ya que al ver los resultados ( Output ) no sabiamos como conseguir esos numeros O.o.
Por si tienen curiosidad les es comparto el ejercicio que nos mareo,  podiamos hacer otro pero estaba demasiado dificil. La parte pintada de verde es lo que no supimos procesar jaja.

Jollo
Jollo is a simple card game which the children from Logonia love to play. It is played between two players with a normal deck of 52 cards. In the game, cards are ordered according to their rank and suit, forming a sequence of 52 ditinct values.

The game is composed of three rounds, played in a best-of-three series( a player must win two rounds to win the game ) . At the beginning of the game the deck is shuffled and each player is given a hand of three card. In each round the players show one card to each other and the player with the highest card win the round. The cards shown in a round are discarded.

The king´s son loves to play the game. But he is not very smart, losing frequently to his sister. And when he loses, he cries so loud no one can stand it. The servant who deals the cards to the Prince and his sister is afraid he will be sent to prision if the Prince continues to lose. The servant is allowed to see every card he deals, and after dealing five card ( three to the princess and two to the prince ) he wants to know which is the lowest card he should deal to the prince so that there is no chance he will lose the game, no matter how badly he plays.

INPUT
Each test case is given in a saingle line that contains five distinct integers A,B,C,X and Y, describing the cards dealt to the players. The first three cards are given to the princess ( 1< A,B,C  <52 ) and the last two are given to the prince ( 1<X, Y < 52 ). The last test case is followed by a line containing five zeros.

OUTPUT
For each test case output a single line.If there exists a card that will make the prince win the game no matter hoy badly he plays, you must print the lowest such a card. Otherwise, print -1.

Sample Input
28 51 29 59 52
50 26 19 10 27
10 20 30 24 26

Sample Output
30
-1
21
51

1 comentario:

  1. Jajajaj, me divertí. Bien, es usted muy creativo, mucho. Siga escribiendo porque le faltan entradas, ¿eh?

    ResponderEliminar