10646 - What is the Card?

All about problems in Volume 106. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

zapstar
New poster
Posts: 2
Joined: Wed Apr 27, 2016 4:47 pm

Steps to get AC with this poorly worded problem

Post by zapstar » Sat Apr 30, 2016 7:54 pm

The wordings with this problem were terrible. I could not understand half of it the first time I read it.... :o

But I managed to get AC. This is a simulation problem, there's not much logic involved, so I'll give out detailed steps on how to get AC.

1. There are 52 cards, the score of the cards = {A, K, Q, J, T} = 10, rest are their independent numbers. There's a comment lurking here that misguides you about this, what I've mentioned in this point is the right way to score individual cards.

2. The cards are indexed backwards. first element in the array is the 52th card (bottom of the pile).

3. Indexing starts from 1 in the problem, you should account for it while using zero indexes.

Simulation: Remove the top 25 cards, and keep them somewhere safe. So your pile will the 26th card on the top. Perform the iteration specified (Find the score of the card which is at the top, remove it. Depending on the score remove [10 - X] more cards from the top of the pile[can be zero]). Once the iteration is done, put back those those original 25 cards which you removed initially.

While performing the three iterations, do remember to keep track of the sum of the scores (a.k.a Y in our problem) of each card which was on the top when that iteration started.

The solution is to find the Yth card from the bottom accounting for all the removed cards from the deck.

IanSwartz
New poster
Posts: 6
Joined: Wed Sep 18, 2013 11:44 am

Re: 10646 - What is the Card?

Post by IanSwartz » Fri Jan 27, 2017 9:25 pm

Agreed Zapster. Some of the problems are very simple, but worded very confusingly that most of the time is spent trying to decipher the wording alone.

To simplify (for those still confused by the wording), In the example:

Code: Select all

1
2D TC TS 2C 9H 8S AH QC JC 9S 7H 2S 3C 4H AC 8C 3S 5D 7C 6C KC AS QS 5H 9D TD 7D 6S JD JS 3H QD 5S 6D 3D TH KH 2H 4D QH KD 4S 8H 9C 8D 6H JH 5C 7S AD KS 4C 
This is the top 25 cards.

Code: Select all

6S JD JS 3H QD 5S 6D 3D TH KH 2H 4D QH KD 4S 8H 9C 8D 6H JH 5C 7S AD KS 4C 
Or put more visually

Code: Select all

This is the bottom ----> 2D TC TS 2C 9H 8S AH QC JC 9S 7H 2S 3C 4H AC 8C 3S 5D 7C 6C KC AS QS 5H 9D TD 7D 6S JD JS 3H QD 5S 6D 3D TH KH 2H 4D QH KD 4S 8H 9C 8D 6H JH 5C 7S AD KS 4C  <---- and this is the top.

metaphysis
Experienced poster
Posts: 113
Joined: Wed May 18, 2011 3:04 pm

Re: 10646 - What is the Card?

Post by metaphysis » Thu Jan 04, 2018 4:10 am

Bad problem statement!
My solutions for UVa problems: https://github.com/metaphysis/Code.

Post Reply

Return to “Volume 106 (10600-10699)”