Блог пользователя magnus_89

Автор magnus_89, история, 3 месяца назад, По-английски

I am confused to solve this problem that how can i do that can somebody tell me something about that problem Problem

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится

»
3 месяца назад, скрыть # |
Rev. 2  
Проголосовать: нравится +8 Проголосовать: не нравится

Just brute force 4 ways to make a game.

1) First player takes his first card, Second player takes his first card 2) First player takes his first card, Second player takes his second card 3) First player takes his second card, Second player takes his first card 4) First player takes his second card, Second player takes his second card

For each way you already chose the cards were taken in first round and you can easily determine which cards they will put in the second round (just because they had 2 cards).

For each round of the game you can just calculate score (if card1 > card2 then point to First player etc). And from these 4 ways you need to count a ways when the second player wins

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

362136303

If Suneet wants to win a round against Slavic, he has to meet one of these conditions:

  • Suneet's 1st card is equal to Slavic's 1st card, and Suneet's 2nd card is greater than Slavic's 2nd card.
  • Suneet's 1st card is greater than Slavic's 1st card, and Suneet's 2nd card is greater than or equal to Slavic's 2nd card.
  • Suneet's 1st card is equal to Slavic's 2nd card, and Suneet's 2nd card is greater than Slavic's 1st card.
  • ... (all pairs of Slavic's cards and Sunnet's cards)
»
3 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

you can do it by o(1) ,if you observe it wisely