Search found 6 matches

by regis
Wed Mar 18, 2009 2:20 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320762

Re: 100

Ha! There's difference in problem description. If you look at website, they say input is between 1 and 999999 but if you check out pdf file the input is between 1 and 9999. I've downloaded pdf file and worked on it and that's why I get errors (I've assumed that max input is 9999 and in fact it is ...
by regis
Wed Mar 18, 2009 10:17 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320762

Re: 100

You are right, but I don't agree completely with you, because the input in this problem is between 1 and 9999
by regis
Tue Mar 17, 2009 11:23 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320762

Re: 100

Thank you, but that's not the problem. When I'm applying values to tab[k] I'm still in for loop with values of k from i to j. I've checked, and program runs OK without these lines:

licznik = licznik + tab[wejscie] - 1;
break;


So I assume that problem lies there but I don't know why. When I ...
by regis
Mon Mar 16, 2009 2:59 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320762

Re: 100

Hi, could you help me? I'm trying to memorize previous results and speed up my solution, but I always get Runtime Error. I know the problem is with getting out from the while loop and I don't know why. Please help me :)


#include <iostream>

int main()
{
long k=0;
long wejscie;
long max;
long ...
by regis
Sat Mar 14, 2009 12:52 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320762

Re: 100

I've got answer accepted :-) Reading from input wasn't the problem, just had to remove stack and table and make it as simple as it gets. It's not so fast, but it's working. Right now I'm trying to optymize it.
by regis
Fri Mar 13, 2009 11:54 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320762

Re: 100

Please, could you help me?
I have runtime error. I guess problem is in reading input with while, when I don't use it I get wrong answer ;)
What's wrong with my while?


#include <iostream>
using namespace std;


//stack
class stos{
long licznik;
long rozmiar;
long* tablica;
public:
void push ...

Go to advanced search