magnus_89's blog

By magnus_89, history, 3 months ago, In English

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

  • Vote: I like it
  • -19
  • Vote: I do not like it

»
3 months ago, hide # |
Rev. 2  
Vote: I like it +8 Vote: I do not like it

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 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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