## Search found 10 matches

Fri Jul 26, 2002 8:28 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16554
ok i understand the algo but not working through it correctly

given n = 3 and m = 5

k would be 2, so first move 2 rings to b.

now m = 2

k = 1

1 rings from b to c.

m = 1

that yeilds 1 ring on each pole which is correct, but seem to have a move left... what did i do wrong?
Fri Jul 26, 2002 4:59 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 61338
I am getting a time out on this problem. One post said he used an array of prime numbers.. doesn't that kind of defeat the purpose? I know I don't have my output formatted correctly but I am working on spee frist. Here is my code. [cpp]#include <iostream> #include <cmath> using namespace std; const ...
Fri Jul 26, 2002 1:24 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16554
let me ask this.. is there some kind of trick to doing that or it is an algorithm? I need to get back into this kind of thinking.. brain doesn't want to coporate yet.
Thu Jul 25, 2002 9:20 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16554
.. wrote:I suggest you not to move the ring one by one, you should try to move 2^k - 1 rings a time.
when you say "k" what are you refering to? How does it relate to n and m?
Wed Jul 24, 2002 7:17 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 26595
yes I am using windows. I guess i missread the documentation. it is usually pretty good at telling me when something is not standard. Anyway i swtiched to the toupper and my compile errors are gone. Now I am timing out(seems to be a common problem for me lately). Any idea what my code is messing up ...
Wed Jul 24, 2002 4:36 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 26595
ok I think I have finally figured this out. I wrote my own compare routine for the sort algorithm to call. the program compiles on my system (win 2k and vc++) but I get a few compile errors from the judge. here are the errors I am getting. 00973177_24.c: In function `bool bSorted(basic_string<char,s...
Wed Jul 24, 2002 1:34 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16554
interesting idea. I will have to think about that. Thanks for the tip.
Wed Jul 24, 2002 1:22 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16554
thanks for pointing that out. That was a silly mistake on my part.

Still doesn't deal with my timeout issue. I am using the correct algorithm for solving hanoi, but that number that you gave is pretty large. Must be why i time out. Is there a trick to this problem like a shortcut?
Tue Jul 23, 2002 9:05 pm
Forum: C++
Topic: need help with cin and blank inputs
Replies: 2
Views: 2327

### need help with cin and blank inputs

ok what seems to be tripping me up on a few of these contest is how to deal with a blank input such as a space or carraiage return. I am trying to use cin and can't seem to trap it.

I have tried

while(cin >> input)

but i loop forever.
Tue Jul 23, 2002 2:46 pm
Forum: Volume 2 (200-299)
Topic: 254 - Towers of Hanoi
Replies: 39
Views: 16554

### 254 - Towers of Hanoi

So I have what appears to me to be a working solution to problem 254, but the judge seems to think otherwise 8). I have timed out. Not sure what my issue is, maybe i was given input that I did not account for. I could use a push in the right diretion. At least when I type valid data, the program app...