Page 1 of 1
635 - Clock solitaire
Posted: Thu Apr 15, 2004 1:07 pm
by Dominik Michniewski
Does anyone know any trap in this problem ?
I try just to simulate this solitaire, but I got WA many times. Maybe I miss something in description ?
Maybe some IO ?
Edited:
Sorry, I made another silly mistake in my code. I wrong understood some sentences in description.
Best regards
DM
don't get it..
Posted: Sat Apr 09, 2005 2:03 pm
by sohel
I also use simulation, but can't get the sample right.
- what exactly is 52 cycle shifts..
Is it equivalent to placing the first card at the last place and then giving away the cards... and do this 52 times.
My output for the sample is 8 as opposed to 4, by following the above approach..
Some clarification might open up things for me.
Thanks.
Posted: Thu Jul 14, 2005 1:24 am
by minskcity
You deal 4 card at a time to the same place.
Posted: Fri Oct 14, 2005 5:29 am
by Jan
Posted: Mon Mar 20, 2006 1:00 am
by sluga
I am trying to solve this problem, but I don't think I understand the description. I keep geting 0 as an answer to the sample input.
I do the following:
for every cycle ( if ABC were initial cards, then I suppose cycles were ABC, CAB and BCA ), I do the simulation:
In the simulation, I divide the cards into 13 queues and start from the 13. queue. I pick the lowest card and place it in the proper queue. I go through the cards until I pick some card I moved before. I count the number of turned cards. If this number is 52, this is winning configuration.
What am I doing wrong?
Posted: Mon Mar 20, 2006 2:28 am
by kalinov
Check if you convert characters in the input to numbers correctly.
'A' is considered 11 o'clock, and 'J' is 1 o'clock, although I think it would be more logical otherwise.
Also there is no mention of character 'T' in the problem statement while there is 'T' in the sample input, not "10".
When you deal the cards, put four cards on one o'clock first, then next four cards on two o'clock... and finally the last four cards at the center.
I hope it helps :)
Posted: Mon Mar 20, 2006 10:06 am
by sluga
Thanks!

Re: 635 - Clock solitaire
Posted: Tue Aug 30, 2016 11:04 am
by metaphysis
The statement of problem is not so clear, I spent some time on Internet to figure out the rule of Clock game. The rule in this problem differs from regular rule. you should beware of two points below:
1. When you deal the cards, you should place four card at one clock, then four cards at two clock, and so on, for sample input, the cards at one clock is: 7 J 9 3, the order is from bottom to top, 7 is the bottommost card, 3 is the topmost card.
2. "cyclic shifts" means move the first card to last place of sequence, deal cards and play again to check successful or not untill sequence return to original state.
Re: 635 - Clock solitaire
Posted: Tue Aug 30, 2016 11:18 am
by metaphysis
The test data generator.
Code: Select all
#include <iostream>
#include <algorithm>
#include <ctime>
#include <random>
using namespace std;
int main(int argc, char *argv[])
{
string cards = "7J93JQKA23456789T8QKA23456789TJQKA23456789TJQKA2T456";
for (int i = 1; i <= 100; i++)
{
shuffle (cards.begin(), cards.end(), default_random_engine(time(NULL)));
for (int j = 0; j < cards.length(); j++)
{
if (j > 0)
cout << ' ';
cout << cards[j];
}
cout << '\n';
}
cout << "0\n";
return 0;
}