Search found 1 match

by kis
Fri Mar 13, 2009 1:52 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320256

Re: If you get WA in problem 100, read me before post!

hi, here's my code (get WA), plz help me.
#include <iostream>

#define nn 1000000

using namespace std;

int seqL[nn];

int howL(long long n) {
if (n == 1)
return 1;
else
if (n<nn) {
if (seqL[n] == 0)
seqL[n] = 1+howL(n & 1? n*3+1: n/2);
return seqL[n];
} else
return 1+howL(n & 1? n*3+1: n ...

Go to advanced search